From 482f2ac2ccf0a428aa0800e5238b7b52d73178c7 Mon Sep 17 00:00:00 2001
From: Shazron Abdullah <shazron@gmail.com>
Date: Tue, 16 Dec 2014 16:45:01 -0500
Subject: [PATCH] CB-7938 - Added XCTest unit tests project, with stubs
 (adapted from SplashScreen unit test setup) (closes #60)

---
 src/ios/UIImage+CropScaleOrientation.h        |   1 +
 src/ios/UIImage+CropScaleOrientation.m        |   9 +-
 tests/ios/.gitignore                          |   1 +
 .../contents.xcworkspacedata                  |   7 +
 .../xcshareddata/CDVCameraTest.xccheckout     |  41 ++
 .../xcschemes/CordovaLib.xcscheme             |  77 +++
 .../CDVCameraLibTests/CameraTest.m            | 498 ++++++++++++++++
 .../CDVCameraLibTests/Info.plist              |  24 +
 .../CDVCameraTest.xcodeproj/project.pbxproj   | 561 ++++++++++++++++++
 .../contents.xcworkspacedata                  |   7 +
 .../xcshareddata/CDVCameraTest.xccheckout     |  41 ++
 .../xcschemes/CDVCameraLib.xcscheme           |  77 +++
 .../xcschemes/CDVCameraLibTests.xcscheme      |  96 +++
 tests/ios/README.md                           |  21 +
 tests/ios/package.json                        |  13 +
 15 files changed, 1472 insertions(+), 2 deletions(-)
 create mode 100644 tests/ios/.gitignore
 create mode 100644 tests/ios/CDVCameraTest.xcworkspace/contents.xcworkspacedata
 create mode 100644 tests/ios/CDVCameraTest.xcworkspace/xcshareddata/CDVCameraTest.xccheckout
 create mode 100644 tests/ios/CDVCameraTest.xcworkspace/xcshareddata/xcschemes/CordovaLib.xcscheme
 create mode 100644 tests/ios/CDVCameraTest/CDVCameraLibTests/CameraTest.m
 create mode 100644 tests/ios/CDVCameraTest/CDVCameraLibTests/Info.plist
 create mode 100644 tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/project.pbxproj
 create mode 100644 tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata
 create mode 100644 tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/project.xcworkspace/xcshareddata/CDVCameraTest.xccheckout
 create mode 100644 tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/xcshareddata/xcschemes/CDVCameraLib.xcscheme
 create mode 100644 tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/xcshareddata/xcschemes/CDVCameraLibTests.xcscheme
 create mode 100644 tests/ios/README.md
 create mode 100644 tests/ios/package.json

diff --git a/src/ios/UIImage+CropScaleOrientation.h b/src/ios/UIImage+CropScaleOrientation.h
index 0f7fca5..31bc42f 100644
--- a/src/ios/UIImage+CropScaleOrientation.h
+++ b/src/ios/UIImage+CropScaleOrientation.h
@@ -23,6 +23,7 @@
 
 - (UIImage*)imageByScalingAndCroppingForSize:(CGSize)targetSize;
 - (UIImage*)imageCorrectedForCaptureOrientation;
+- (UIImage*)imageCorrectedForCaptureOrientation:(UIImageOrientation)imageOrientation;
 - (UIImage*)imageByScalingNotCroppingForSize:(CGSize)targetSize;
 
 @end
\ No newline at end of file
diff --git a/src/ios/UIImage+CropScaleOrientation.m b/src/ios/UIImage+CropScaleOrientation.m
index 3ab3ad5..a66a5d8 100644
--- a/src/ios/UIImage+CropScaleOrientation.m
+++ b/src/ios/UIImage+CropScaleOrientation.m
@@ -74,12 +74,12 @@
     return newImage;
 }
 
-- (UIImage*)imageCorrectedForCaptureOrientation
+- (UIImage*)imageCorrectedForCaptureOrientation:(UIImageOrientation)imageOrientation
 {
     float rotation_radians = 0;
     bool perpendicular = false;
     
-    switch ([self imageOrientation]) {
+    switch (imageOrientation) {
         case UIImageOrientationUp :
             rotation_radians = 0.0;
             break;
@@ -124,6 +124,11 @@
     return newImage;
 }
 
+- (UIImage*)imageCorrectedForCaptureOrientation
+{
+    return [self imageCorrectedForCaptureOrientation:[self imageOrientation]];
+}
+
 - (UIImage*)imageByScalingNotCroppingForSize:(CGSize)targetSize
 {
     UIImage* sourceImage = self;
diff --git a/tests/ios/.gitignore b/tests/ios/.gitignore
new file mode 100644
index 0000000..b512c09
--- /dev/null
+++ b/tests/ios/.gitignore
@@ -0,0 +1 @@
+node_modules
\ No newline at end of file
diff --git a/tests/ios/CDVCameraTest.xcworkspace/contents.xcworkspacedata b/tests/ios/CDVCameraTest.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..22fcf41
--- /dev/null
+++ b/tests/ios/CDVCameraTest.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+   version = "1.0">
+   <FileRef
+      location = "container:CDVCameraTest/CDVCameraTest.xcodeproj">
+   </FileRef>
+</Workspace>
diff --git a/tests/ios/CDVCameraTest.xcworkspace/xcshareddata/CDVCameraTest.xccheckout b/tests/ios/CDVCameraTest.xcworkspace/xcshareddata/CDVCameraTest.xccheckout
new file mode 100644
index 0000000..c8a5605
--- /dev/null
+++ b/tests/ios/CDVCameraTest.xcworkspace/xcshareddata/CDVCameraTest.xccheckout
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>IDESourceControlProjectFavoriteDictionaryKey</key>
+	<false/>
+	<key>IDESourceControlProjectIdentifier</key>
+	<string>6BE9AD73-1B9F-4362-98D7-DC631BEC6185</string>
+	<key>IDESourceControlProjectName</key>
+	<string>CDVCameraTest</string>
+	<key>IDESourceControlProjectOriginsDictionary</key>
+	<dict>
+		<key>729B5706E7BAF4E9EE7AEE3C003A08107411AB7C</key>
+		<string>github.com:shazron/cordova-plugin-camera.git</string>
+	</dict>
+	<key>IDESourceControlProjectPath</key>
+	<string>tests/ios/CDVCameraTest.xcworkspace</string>
+	<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
+	<dict>
+		<key>729B5706E7BAF4E9EE7AEE3C003A08107411AB7C</key>
+		<string>../../..</string>
+	</dict>
+	<key>IDESourceControlProjectURL</key>
+	<string>github.com:shazron/cordova-plugin-camera.git</string>
+	<key>IDESourceControlProjectVersion</key>
+	<integer>111</integer>
+	<key>IDESourceControlProjectWCCIdentifier</key>
+	<string>729B5706E7BAF4E9EE7AEE3C003A08107411AB7C</string>
+	<key>IDESourceControlProjectWCConfigurations</key>
+	<array>
+		<dict>
+			<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
+			<string>public.vcs.git</string>
+			<key>IDESourceControlWCCIdentifierKey</key>
+			<string>729B5706E7BAF4E9EE7AEE3C003A08107411AB7C</string>
+			<key>IDESourceControlWCCName</key>
+			<string>cordova-plugin-camera</string>
+		</dict>
+	</array>
+</dict>
+</plist>
diff --git a/tests/ios/CDVCameraTest.xcworkspace/xcshareddata/xcschemes/CordovaLib.xcscheme b/tests/ios/CDVCameraTest.xcworkspace/xcshareddata/xcschemes/CordovaLib.xcscheme
new file mode 100644
index 0000000..3e8cd2c
--- /dev/null
+++ b/tests/ios/CDVCameraTest.xcworkspace/xcshareddata/xcschemes/CordovaLib.xcscheme
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   LastUpgradeVersion = "0610"
+   version = "1.3">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "D2AAC07D0554694100DB518D"
+               BuildableName = "libCordova.a"
+               BlueprintName = "CordovaLib"
+               ReferencedContainer = "container:node_modules/cordova-ios/CordovaLib/CordovaLib.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      buildConfiguration = "Debug">
+      <Testables>
+      </Testables>
+   </TestAction>
+   <LaunchAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Debug"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      allowLocationSimulation = "YES">
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "D2AAC07D0554694100DB518D"
+            BuildableName = "libCordova.a"
+            BlueprintName = "CordovaLib"
+            ReferencedContainer = "container:node_modules/cordova-ios/CordovaLib/CordovaLib.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </LaunchAction>
+   <ProfileAction
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Release"
+      debugDocumentVersioning = "YES">
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "D2AAC07D0554694100DB518D"
+            BuildableName = "libCordova.a"
+            BlueprintName = "CordovaLib"
+            ReferencedContainer = "container:node_modules/cordova-ios/CordovaLib/CordovaLib.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>
diff --git a/tests/ios/CDVCameraTest/CDVCameraLibTests/CameraTest.m b/tests/ios/CDVCameraTest/CDVCameraLibTests/CameraTest.m
new file mode 100644
index 0000000..d0e8b4b
--- /dev/null
+++ b/tests/ios/CDVCameraTest/CDVCameraLibTests/CameraTest.m
@@ -0,0 +1,498 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import <UIKit/UIKit.h>
+#import <XCTest/XCTest.h>
+#import "CDVCamera.h"
+#import "UIImage+CropScaleOrientation.h"
+#import <Cordova/NSArray+Comparisons.h>
+#import <Cordova/NSData+Base64.h>
+#import <Cordova/NSDictionary+Extensions.h>
+#import <MobileCoreServices/UTCoreTypes.h>
+
+
+@interface CameraTest : XCTestCase
+
+@property (nonatomic, strong) CDVCamera* plugin;
+
+@end
+
+@interface CDVCamera ()
+
+// expose private interface
+- (NSData*)processImage:(UIImage*)image info:(NSDictionary*)info options:(CDVPictureOptions*)options;
+- (UIImage*)retrieveImage:(NSDictionary*)info options:(CDVPictureOptions*)options;
+- (CDVPluginResult*)resultForImage:(CDVPictureOptions*)options info:(NSDictionary*)info;
+- (CDVPluginResult*)resultForVideo:(NSDictionary*)info;
+
+@end
+
+@implementation CameraTest
+
+- (void)setUp {
+    [super setUp];
+    // Put setup code here. This method is called before the invocation of each test method in the class.
+    
+    self.plugin = [[CDVCamera alloc] init];
+}
+
+- (void)tearDown {
+    // Put teardown code here. This method is called after the invocation of each test method in the class.
+    [super tearDown];
+}
+
+- (void) testPictureOptionsCreate
+{
+    NSArray* args;
+    CDVPictureOptions* options;
+    NSDictionary* popoverOptions;
+    
+    // No arguments, check whether the defaults are set
+    args = @[];
+    options = [CDVPictureOptions createFromTakePictureArguments:args];
+    
+    XCTAssertEqual([options.quality intValue], 50);
+    XCTAssertEqual(options.destinationType, (int)DestinationTypeFileUri);
+    XCTAssertEqual(options.sourceType, (int)UIImagePickerControllerSourceTypeCamera);
+    XCTAssertEqual(options.targetSize.width, 0);
+    XCTAssertEqual(options.targetSize.height, 0);
+    XCTAssertEqual(options.encodingType, (int)EncodingTypeJPEG);
+    XCTAssertEqual(options.mediaType, (int)MediaTypePicture);
+    XCTAssertEqual(options.allowsEditing, NO);
+    XCTAssertEqual(options.correctOrientation, NO);
+    XCTAssertEqual(options.saveToPhotoAlbum, NO);
+    XCTAssertEqualObjects(options.popoverOptions, nil);
+    XCTAssertEqual(options.cameraDirection, (int)UIImagePickerControllerCameraDeviceRear);
+    XCTAssertEqual(options.popoverSupported, NO);
+    XCTAssertEqual(options.usesGeolocation, NO);
+    
+    // Set each argument, check whether they are set. different from defaults
+    popoverOptions = @{ @"x" : @1, @"y" : @2, @"width" : @3, @"height" : @4 };
+    
+    args = @[
+             @(49),
+             @(DestinationTypeDataUrl),
+             @(UIImagePickerControllerSourceTypePhotoLibrary),
+             @(120),
+             @(240),
+             @(EncodingTypePNG),
+             @(MediaTypeVideo),
+             @YES,
+             @YES,
+             @YES,
+             popoverOptions,
+             @(UIImagePickerControllerCameraDeviceFront),
+             ];
+    options = [CDVPictureOptions createFromTakePictureArguments:args];
+    
+    XCTAssertEqual([options.quality intValue], 49);
+    XCTAssertEqual(options.destinationType, (int)DestinationTypeDataUrl);
+    XCTAssertEqual(options.sourceType, (int)UIImagePickerControllerSourceTypePhotoLibrary);
+    XCTAssertEqual(options.targetSize.width, 120);
+    XCTAssertEqual(options.targetSize.height, 240);
+    XCTAssertEqual(options.encodingType, (int)EncodingTypePNG);
+    XCTAssertEqual(options.mediaType, (int)MediaTypeVideo);
+    XCTAssertEqual(options.allowsEditing, YES);
+    XCTAssertEqual(options.correctOrientation, YES);
+    XCTAssertEqual(options.saveToPhotoAlbum, YES);
+    XCTAssertEqualObjects(options.popoverOptions, popoverOptions);
+    XCTAssertEqual(options.cameraDirection, (int)UIImagePickerControllerCameraDeviceFront);
+    XCTAssertEqual(options.popoverSupported, NO);
+    XCTAssertEqual(options.usesGeolocation, NO);
+}
+
+- (void) testCameraPickerCreate
+{
+    NSDictionary* popoverOptions;
+    NSArray* args;
+    CDVPictureOptions* pictureOptions;
+    CDVCameraPicker* picker;
+    
+    // Souce is Camera, and image type
+    
+    popoverOptions = @{ @"x" : @1, @"y" : @2, @"width" : @3, @"height" : @4 };
+    args = @[
+             @(49),
+             @(DestinationTypeDataUrl),
+             @(UIImagePickerControllerSourceTypeCamera),
+             @(120),
+             @(240),
+             @(EncodingTypePNG),
+             @(MediaTypeAll),
+             @YES,
+             @YES,
+             @YES,
+             popoverOptions,
+             @(UIImagePickerControllerCameraDeviceFront),
+             ];
+    pictureOptions = [CDVPictureOptions createFromTakePictureArguments:args];
+    
+    if ([UIImagePickerController isSourceTypeAvailable:pictureOptions.sourceType]) {
+        picker = [CDVCameraPicker createFromPictureOptions:pictureOptions];
+        
+        XCTAssertEqualObjects(picker.pictureOptions, pictureOptions);
+
+        XCTAssertEqual(picker.sourceType, pictureOptions.sourceType);
+        XCTAssertEqual(picker.allowsEditing, pictureOptions.allowsEditing);
+        XCTAssertEqualObjects(picker.mediaTypes, @[(NSString*)kUTTypeImage]);
+        XCTAssertEqual(picker.cameraDevice, pictureOptions.cameraDirection);
+    }
+
+    // Souce is not Camera, and all media types
+
+    args = @[
+          @(49),
+          @(DestinationTypeDataUrl),
+          @(UIImagePickerControllerSourceTypePhotoLibrary),
+          @(120),
+          @(240),
+          @(EncodingTypePNG),
+          @(MediaTypeAll),
+          @YES,
+          @YES,
+          @YES,
+          popoverOptions,
+          @(UIImagePickerControllerCameraDeviceFront),
+          ];
+    pictureOptions = [CDVPictureOptions createFromTakePictureArguments:args];
+
+    if ([UIImagePickerController isSourceTypeAvailable:pictureOptions.sourceType]) {
+        picker = [CDVCameraPicker createFromPictureOptions:pictureOptions];
+
+         XCTAssertEqualObjects(picker.pictureOptions, pictureOptions);
+         
+         XCTAssertEqual(picker.sourceType, pictureOptions.sourceType);
+         XCTAssertEqual(picker.allowsEditing, pictureOptions.allowsEditing);
+         XCTAssertEqualObjects(picker.mediaTypes, [UIImagePickerController availableMediaTypesForSourceType:picker.sourceType]);
+    }
+    
+    // Souce is not Camera, and either Image or Movie media type
+
+    args = @[
+             @(49),
+             @(DestinationTypeDataUrl),
+             @(UIImagePickerControllerSourceTypePhotoLibrary),
+             @(120),
+             @(240),
+             @(EncodingTypePNG),
+             @(MediaTypeVideo),
+             @YES,
+             @YES,
+             @YES,
+             popoverOptions,
+             @(UIImagePickerControllerCameraDeviceFront),
+             ];
+    pictureOptions = [CDVPictureOptions createFromTakePictureArguments:args];
+    
+    if ([UIImagePickerController isSourceTypeAvailable:pictureOptions.sourceType]) {
+        picker = [CDVCameraPicker createFromPictureOptions:pictureOptions];
+        
+        XCTAssertEqualObjects(picker.pictureOptions, pictureOptions);
+        
+        XCTAssertEqual(picker.sourceType, pictureOptions.sourceType);
+        XCTAssertEqual(picker.allowsEditing, pictureOptions.allowsEditing);
+        XCTAssertEqualObjects(picker.mediaTypes, @[(NSString*)kUTTypeMovie]);
+    }
+}
+
+- (UIImage*) createImage:(CGRect)rect orientation:(UIImageOrientation)imageOrientation {
+    UIGraphicsBeginImageContext(rect.size);
+    CGContextRef context = UIGraphicsGetCurrentContext();
+    
+    CGContextSetFillColorWithColor(context, [[UIColor greenColor] CGColor]);
+    CGContextFillRect(context, rect);
+    
+    CGImageRef result = CGBitmapContextCreateImage(UIGraphicsGetCurrentContext());
+    UIImage* image = [UIImage imageWithCGImage:result scale:1.0f orientation:imageOrientation];
+    
+    UIGraphicsEndImageContext();
+    
+    return image;
+}
+
+- (void) testImageScaleCropForSize {
+    
+    UIImage *sourceImagePortrait, *sourceImageLandscape, *targetImage;
+    CGSize targetSize = CGSizeZero;
+    
+    sourceImagePortrait = [self createImage:CGRectMake(0, 0, 2448, 3264) orientation:UIImageOrientationUp];
+    sourceImageLandscape = [self createImage:CGRectMake(0, 0, 3264, 2448) orientation:UIImageOrientationUp];
+    
+    // test 640x480
+    
+    targetSize = CGSizeMake(640, 480);
+
+    targetImage = [sourceImagePortrait imageByScalingAndCroppingForSize:targetSize];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+
+    targetImage = [sourceImageLandscape imageByScalingAndCroppingForSize:targetSize];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+
+
+    // test 800x600
+    
+    targetSize = CGSizeMake(800, 600);
+    
+    targetImage = [sourceImagePortrait imageByScalingAndCroppingForSize:targetSize];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+    
+    targetImage = [sourceImageLandscape imageByScalingAndCroppingForSize:targetSize];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+    
+    // test 1024x768
+    
+    targetSize = CGSizeMake(1024, 768);
+    
+    targetImage = [sourceImagePortrait imageByScalingAndCroppingForSize:targetSize];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+
+    targetImage = [sourceImageLandscape imageByScalingAndCroppingForSize:targetSize];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+}
+
+- (void) testImageScaleNoCropForSize {
+    UIImage *sourceImagePortrait, *sourceImageLandscape, *targetImage;
+    CGSize targetSize = CGSizeZero;
+    
+    sourceImagePortrait = [self createImage:CGRectMake(0, 0, 2448, 3264) orientation:UIImageOrientationUp];
+    sourceImageLandscape = [self createImage:CGRectMake(0, 0, 3264, 2448) orientation:UIImageOrientationUp];
+    
+    // test 640x480
+    
+    targetSize = CGSizeMake(640, 480);
+    
+    targetImage = [sourceImagePortrait imageByScalingNotCroppingForSize:targetSize];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+    
+    targetImage = [sourceImageLandscape imageByScalingNotCroppingForSize:targetSize];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+    
+    
+    // test 800x600
+    
+    targetSize = CGSizeMake(800, 600);
+    
+    targetImage = [sourceImagePortrait imageByScalingNotCroppingForSize:targetSize];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+    
+    targetImage = [sourceImageLandscape imageByScalingNotCroppingForSize:targetSize];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+    
+    // test 1024x768
+    
+    targetSize = CGSizeMake(1024, 768);
+    
+    targetImage = [sourceImagePortrait imageByScalingNotCroppingForSize:targetSize];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+    
+    targetImage = [sourceImageLandscape imageByScalingNotCroppingForSize:targetSize];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+}
+
+- (void) testImageCorrectedForOrientation {
+    UIImage *sourceImagePortrait, *sourceImageLandscape, *targetImage;
+    CGSize targetSize = CGSizeZero;
+    
+    sourceImagePortrait = [self createImage:CGRectMake(0, 0, 2448, 3264) orientation:UIImageOrientationDown];
+    sourceImageLandscape = [self createImage:CGRectMake(0, 0, 3264, 2448) orientation:UIImageOrientationDown];
+    
+    // PORTRAIT - image size should be unchanged
+
+    targetSize = CGSizeMake(2448, 3264);
+    
+    targetImage = [sourceImagePortrait imageCorrectedForCaptureOrientation:UIImageOrientationUp];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+    XCTAssertEqual(targetImage.imageOrientation, UIImageOrientationUp);
+
+    targetImage = [sourceImagePortrait imageCorrectedForCaptureOrientation:UIImageOrientationDown];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+    XCTAssertEqual(targetImage.imageOrientation, UIImageOrientationUp);
+
+    targetImage = [sourceImagePortrait imageCorrectedForCaptureOrientation:UIImageOrientationRight];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+    XCTAssertEqual(targetImage.imageOrientation, UIImageOrientationUp);
+
+    targetImage = [sourceImagePortrait imageCorrectedForCaptureOrientation:UIImageOrientationLeft];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+    XCTAssertEqual(targetImage.imageOrientation, UIImageOrientationUp);
+
+    // LANDSCAPE - image size should be unchanged
+    
+    targetSize = CGSizeMake(3264, 2448);
+    
+    targetImage = [sourceImageLandscape imageCorrectedForCaptureOrientation:UIImageOrientationUp];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+
+    targetImage = [sourceImageLandscape imageCorrectedForCaptureOrientation:UIImageOrientationDown];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+
+    targetImage = [sourceImageLandscape imageCorrectedForCaptureOrientation:UIImageOrientationRight];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+    
+    targetImage = [sourceImageLandscape imageCorrectedForCaptureOrientation:UIImageOrientationLeft];
+    XCTAssertEqual(targetImage.size.width, targetSize.width);
+    XCTAssertEqual(targetImage.size.height, targetSize.height);
+}
+
+
+- (void) testRetrieveImage
+{
+    CDVPictureOptions* pictureOptions = [[CDVPictureOptions alloc] init];
+    NSDictionary *infoDict1, *infoDict2;
+    UIImage* resultImage;
+    
+    UIImage* originalImage = [self createImage:CGRectMake(0, 0, 1024, 768) orientation:UIImageOrientationDown];
+    UIImage* originalCorrectedForOrientation = [originalImage imageCorrectedForCaptureOrientation];
+
+    UIImage* editedImage = [self createImage:CGRectMake(0, 0, 800, 600) orientation:UIImageOrientationDown];
+    UIImage* scaledImageWithCrop = [originalImage imageByScalingAndCroppingForSize:CGSizeMake(640, 480)];
+    UIImage* scaledImageNoCrop = [originalImage imageByScalingNotCroppingForSize:CGSizeMake(640, 480)];
+    
+    infoDict1 = @{
+                  UIImagePickerControllerOriginalImage : originalImage
+                  };
+    
+    infoDict2 = @{
+                   UIImagePickerControllerOriginalImage : originalImage,
+                   UIImagePickerControllerEditedImage : editedImage
+                };
+    
+    // Original with no options
+    
+    pictureOptions.allowsEditing = YES;
+    pictureOptions.targetSize = CGSizeZero;
+    pictureOptions.cropToSize = NO;
+    pictureOptions.correctOrientation = NO;
+    
+    resultImage = [self.plugin retrieveImage:infoDict1 options:pictureOptions];
+    XCTAssertEqualObjects(resultImage, originalImage);
+    
+    // Original with no options
+    
+    pictureOptions.allowsEditing = YES;
+    pictureOptions.targetSize = CGSizeZero;
+    pictureOptions.cropToSize = NO;
+    pictureOptions.correctOrientation = NO;
+    
+    resultImage = [self.plugin retrieveImage:infoDict2 options:pictureOptions];
+    XCTAssertEqualObjects(resultImage, editedImage);
+
+    // Original with corrected orientation
+    
+    pictureOptions.allowsEditing = YES;
+    pictureOptions.targetSize = CGSizeZero;
+    pictureOptions.cropToSize = NO;
+    pictureOptions.correctOrientation = YES;
+    
+    resultImage = [self.plugin retrieveImage:infoDict1 options:pictureOptions];
+    XCTAssertNotEqual(resultImage.imageOrientation, originalImage.imageOrientation);
+    XCTAssertEqual(resultImage.imageOrientation, originalCorrectedForOrientation.imageOrientation);
+    XCTAssertEqual(resultImage.size.width, originalCorrectedForOrientation.size.width);
+    XCTAssertEqual(resultImage.size.height, originalCorrectedForOrientation.size.height);
+
+    // Original with targetSize, no crop
+    
+    pictureOptions.allowsEditing = YES;
+    pictureOptions.targetSize = CGSizeMake(640, 480);
+    pictureOptions.cropToSize = NO;
+    pictureOptions.correctOrientation = NO;
+    
+    resultImage = [self.plugin retrieveImage:infoDict1 options:pictureOptions];
+    XCTAssertEqual(resultImage.size.width, scaledImageNoCrop.size.width);
+    XCTAssertEqual(resultImage.size.height, scaledImageNoCrop.size.height);
+
+    // Original with targetSize, plus crop
+    
+    pictureOptions.allowsEditing = YES;
+    pictureOptions.targetSize = CGSizeMake(640, 480);
+    pictureOptions.cropToSize = YES;
+    pictureOptions.correctOrientation = NO;
+    
+    resultImage = [self.plugin retrieveImage:infoDict1 options:pictureOptions];
+    XCTAssertEqual(resultImage.size.width, scaledImageWithCrop.size.width);
+    XCTAssertEqual(resultImage.size.height, scaledImageWithCrop.size.height);
+}
+
+- (void) testProcessImage
+{
+    CDVPictureOptions* pictureOptions = [[CDVPictureOptions alloc] init];
+    NSData* resultData;
+    
+    UIImage* originalImage = [self createImage:CGRectMake(0, 0, 1024, 768) orientation:UIImageOrientationDown];
+    NSData* originalImageDataPNG = UIImagePNGRepresentation(originalImage);
+    NSData* originalImageDataJPEG = UIImageJPEGRepresentation(originalImage, 1.0);
+    
+    // Original, PNG
+    
+    pictureOptions.allowsEditing = YES;
+    pictureOptions.targetSize = CGSizeZero;
+    pictureOptions.cropToSize = NO;
+    pictureOptions.correctOrientation = NO;
+    pictureOptions.encodingType = EncodingTypePNG;
+    
+    resultData = [self.plugin processImage:originalImage info:@{} options:pictureOptions];
+    XCTAssertEqualObjects([resultData base64EncodedString], [originalImageDataPNG base64EncodedString]);
+
+    // Original, JPEG, full quality
+    
+    pictureOptions.allowsEditing = NO;
+    pictureOptions.targetSize = CGSizeZero;
+    pictureOptions.cropToSize = NO;
+    pictureOptions.correctOrientation = NO;
+    pictureOptions.encodingType = EncodingTypeJPEG;
+    
+    resultData = [self.plugin processImage:originalImage info:@{} options:pictureOptions];
+    XCTAssertEqualObjects([resultData base64EncodedString], [originalImageDataJPEG base64EncodedString]);
+    
+    // Original, JPEG, with quality value
+    
+    pictureOptions.allowsEditing = YES;
+    pictureOptions.targetSize = CGSizeZero;
+    pictureOptions.cropToSize = NO;
+    pictureOptions.correctOrientation = NO;
+    pictureOptions.encodingType = EncodingTypeJPEG;
+    pictureOptions.quality = @(57);
+    
+    NSData* originalImageDataJPEGWithQuality = UIImageJPEGRepresentation(originalImage, [pictureOptions.quality floatValue]/ 100.f);
+    resultData = [self.plugin processImage:originalImage info:@{} options:pictureOptions];
+    XCTAssertEqualObjects([resultData base64EncodedString], [originalImageDataJPEGWithQuality base64EncodedString]);
+    
+    // TODO: usesGeolocation is not tested
+}
+
+@end
diff --git a/tests/ios/CDVCameraTest/CDVCameraLibTests/Info.plist b/tests/ios/CDVCameraTest/CDVCameraLibTests/Info.plist
new file mode 100644
index 0000000..a949946
--- /dev/null
+++ b/tests/ios/CDVCameraTest/CDVCameraLibTests/Info.plist
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleDevelopmentRegion</key>
+	<string>en</string>
+	<key>CFBundleExecutable</key>
+	<string>$(EXECUTABLE_NAME)</string>
+	<key>CFBundleIdentifier</key>
+	<string>org.apache.cordova.$(PRODUCT_NAME:rfc1034identifier)</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleName</key>
+	<string>$(PRODUCT_NAME)</string>
+	<key>CFBundlePackageType</key>
+	<string>BNDL</string>
+	<key>CFBundleShortVersionString</key>
+	<string>1.0</string>
+	<key>CFBundleSignature</key>
+	<string>????</string>
+	<key>CFBundleVersion</key>
+	<string>1</string>
+</dict>
+</plist>
diff --git a/tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/project.pbxproj b/tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..3e5a4c0
--- /dev/null
+++ b/tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/project.pbxproj
@@ -0,0 +1,561 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 46;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		30486FEB1A40DC350065C233 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30486FEA1A40DC350065C233 /* UIKit.framework */; };
+		30486FED1A40DC3B0065C233 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30486FEC1A40DC3A0065C233 /* Foundation.framework */; };
+		30486FF91A40DCC70065C233 /* CDVCamera.m in Sources */ = {isa = PBXBuildFile; fileRef = 30486FF31A40DCC70065C233 /* CDVCamera.m */; };
+		30486FFA1A40DCC70065C233 /* CDVJpegHeaderWriter.m in Sources */ = {isa = PBXBuildFile; fileRef = 30486FF61A40DCC70065C233 /* CDVJpegHeaderWriter.m */; };
+		30486FFB1A40DCC70065C233 /* UIImage+CropScaleOrientation.m in Sources */ = {isa = PBXBuildFile; fileRef = 30486FF81A40DCC70065C233 /* UIImage+CropScaleOrientation.m */; };
+		304870011A40DD620065C233 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30486FFE1A40DD180065C233 /* CoreGraphics.framework */; };
+		304870021A40DD860065C233 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30486FFE1A40DD180065C233 /* CoreGraphics.framework */; };
+		304870031A40DD8C0065C233 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30486FEA1A40DC350065C233 /* UIKit.framework */; };
+		304870051A40DD9A0065C233 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 304870041A40DD9A0065C233 /* MobileCoreServices.framework */; };
+		304870071A40DDAC0065C233 /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 304870061A40DDAC0065C233 /* AssetsLibrary.framework */; };
+		304870091A40DDB90065C233 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 304870081A40DDB90065C233 /* CoreLocation.framework */; };
+		3048700B1A40DDF30065C233 /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3048700A1A40DDF30065C233 /* ImageIO.framework */; };
+		308F59B11A4228730031A4D4 /* libCordova.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7E9F519019DA0F8300DA31AC /* libCordova.a */; };
+		7E9F51B119DA114400DA31AC /* CameraTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E9F51B019DA114400DA31AC /* CameraTest.m */; };
+		7E9F51B919DA1B1600DA31AC /* libCDVCameraLib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7E9F519519DA102000DA31AC /* libCDVCameraLib.a */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+		30486FFC1A40DCE80065C233 /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 7E9F518B19DA0F8300DA31AC /* CordovaLib.xcodeproj */;
+			proxyType = 1;
+			remoteGlobalIDString = D2AAC07D0554694100DB518D;
+			remoteInfo = CordovaLib;
+		};
+		7E9F518F19DA0F8300DA31AC /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 7E9F518B19DA0F8300DA31AC /* CordovaLib.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = 68A32D7114102E1C006B237C;
+			remoteInfo = CordovaLib;
+		};
+		7E9F51AC19DA10DE00DA31AC /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 7E9F517219DA09CE00DA31AC /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = 7E9F519419DA102000DA31AC;
+			remoteInfo = CDVCameraLib;
+		};
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+		7E9F519319DA102000DA31AC /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = "include/$(PRODUCT_NAME)";
+			dstSubfolderSpec = 16;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+		30486FEA1A40DC350065C233 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
+		30486FEC1A40DC3A0065C233 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
+		30486FF21A40DCC70065C233 /* CDVCamera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVCamera.h; sourceTree = "<group>"; };
+		30486FF31A40DCC70065C233 /* CDVCamera.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVCamera.m; sourceTree = "<group>"; };
+		30486FF41A40DCC70065C233 /* CDVExif.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVExif.h; sourceTree = "<group>"; };
+		30486FF51A40DCC70065C233 /* CDVJpegHeaderWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVJpegHeaderWriter.h; sourceTree = "<group>"; };
+		30486FF61A40DCC70065C233 /* CDVJpegHeaderWriter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVJpegHeaderWriter.m; sourceTree = "<group>"; };
+		30486FF71A40DCC70065C233 /* UIImage+CropScaleOrientation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+CropScaleOrientation.h"; sourceTree = "<group>"; };
+		30486FF81A40DCC70065C233 /* UIImage+CropScaleOrientation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+CropScaleOrientation.m"; sourceTree = "<group>"; };
+		30486FFE1A40DD180065C233 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; };
+		304870041A40DD9A0065C233 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/MobileCoreServices.framework; sourceTree = DEVELOPER_DIR; };
+		304870061A40DDAC0065C233 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/AssetsLibrary.framework; sourceTree = DEVELOPER_DIR; };
+		304870081A40DDB90065C233 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/CoreLocation.framework; sourceTree = DEVELOPER_DIR; };
+		3048700A1A40DDF30065C233 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/ImageIO.framework; sourceTree = DEVELOPER_DIR; };
+		7E9F518B19DA0F8300DA31AC /* CordovaLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CordovaLib.xcodeproj; path = "../node_modules/cordova-ios/CordovaLib/CordovaLib.xcodeproj"; sourceTree = "<group>"; };
+		7E9F519519DA102000DA31AC /* libCDVCameraLib.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCDVCameraLib.a; sourceTree = BUILT_PRODUCTS_DIR; };
+		7E9F519F19DA102000DA31AC /* CDVCameraLibTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CDVCameraLibTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
+		7E9F51A219DA102000DA31AC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+		7E9F51B019DA114400DA31AC /* CameraTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CameraTest.m; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		7E9F519219DA102000DA31AC /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				308F59B11A4228730031A4D4 /* libCordova.a in Frameworks */,
+				304870011A40DD620065C233 /* CoreGraphics.framework in Frameworks */,
+				30486FED1A40DC3B0065C233 /* Foundation.framework in Frameworks */,
+				30486FEB1A40DC350065C233 /* UIKit.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		7E9F519C19DA102000DA31AC /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				3048700B1A40DDF30065C233 /* ImageIO.framework in Frameworks */,
+				304870091A40DDB90065C233 /* CoreLocation.framework in Frameworks */,
+				304870071A40DDAC0065C233 /* AssetsLibrary.framework in Frameworks */,
+				304870051A40DD9A0065C233 /* MobileCoreServices.framework in Frameworks */,
+				304870031A40DD8C0065C233 /* UIKit.framework in Frameworks */,
+				304870021A40DD860065C233 /* CoreGraphics.framework in Frameworks */,
+				7E9F51B919DA1B1600DA31AC /* libCDVCameraLib.a in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		30486FF11A40DCC70065C233 /* CDVCameraLib */ = {
+			isa = PBXGroup;
+			children = (
+				30486FF21A40DCC70065C233 /* CDVCamera.h */,
+				30486FF31A40DCC70065C233 /* CDVCamera.m */,
+				30486FF41A40DCC70065C233 /* CDVExif.h */,
+				30486FF51A40DCC70065C233 /* CDVJpegHeaderWriter.h */,
+				30486FF61A40DCC70065C233 /* CDVJpegHeaderWriter.m */,
+				30486FF71A40DCC70065C233 /* UIImage+CropScaleOrientation.h */,
+				30486FF81A40DCC70065C233 /* UIImage+CropScaleOrientation.m */,
+			);
+			name = CDVCameraLib;
+			path = ../../../src/ios;
+			sourceTree = "<group>";
+		};
+		308F59B01A4227A60031A4D4 /* Frameworks */ = {
+			isa = PBXGroup;
+			children = (
+				3048700A1A40DDF30065C233 /* ImageIO.framework */,
+				304870081A40DDB90065C233 /* CoreLocation.framework */,
+				304870061A40DDAC0065C233 /* AssetsLibrary.framework */,
+				304870041A40DD9A0065C233 /* MobileCoreServices.framework */,
+				30486FFE1A40DD180065C233 /* CoreGraphics.framework */,
+				30486FEC1A40DC3A0065C233 /* Foundation.framework */,
+				30486FEA1A40DC350065C233 /* UIKit.framework */,
+			);
+			name = Frameworks;
+			sourceTree = "<group>";
+		};
+		7E9F517119DA09CE00DA31AC = {
+			isa = PBXGroup;
+			children = (
+				7E9F518B19DA0F8300DA31AC /* CordovaLib.xcodeproj */,
+				308F59B01A4227A60031A4D4 /* Frameworks */,
+				30486FF11A40DCC70065C233 /* CDVCameraLib */,
+				7E9F51A019DA102000DA31AC /* CDVCameraLibTests */,
+				7E9F517D19DA0A0A00DA31AC /* Products */,
+			);
+			sourceTree = "<group>";
+		};
+		7E9F517D19DA0A0A00DA31AC /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				7E9F519519DA102000DA31AC /* libCDVCameraLib.a */,
+				7E9F519F19DA102000DA31AC /* CDVCameraLibTests.xctest */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		7E9F518C19DA0F8300DA31AC /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				7E9F519019DA0F8300DA31AC /* libCordova.a */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		7E9F51A019DA102000DA31AC /* CDVCameraLibTests */ = {
+			isa = PBXGroup;
+			children = (
+				7E9F51A119DA102000DA31AC /* Supporting Files */,
+				7E9F51B019DA114400DA31AC /* CameraTest.m */,
+			);
+			path = CDVCameraLibTests;
+			sourceTree = "<group>";
+		};
+		7E9F51A119DA102000DA31AC /* Supporting Files */ = {
+			isa = PBXGroup;
+			children = (
+				7E9F51A219DA102000DA31AC /* Info.plist */,
+			);
+			name = "Supporting Files";
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		7E9F519419DA102000DA31AC /* CDVCameraLib */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 7E9F51A319DA102000DA31AC /* Build configuration list for PBXNativeTarget "CDVCameraLib" */;
+			buildPhases = (
+				7E9F519119DA102000DA31AC /* Sources */,
+				7E9F519219DA102000DA31AC /* Frameworks */,
+				7E9F519319DA102000DA31AC /* CopyFiles */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				30486FFD1A40DCE80065C233 /* PBXTargetDependency */,
+			);
+			name = CDVCameraLib;
+			productName = CDVCameraLib;
+			productReference = 7E9F519519DA102000DA31AC /* libCDVCameraLib.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+		7E9F519E19DA102000DA31AC /* CDVCameraLibTests */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 7E9F51A619DA102000DA31AC /* Build configuration list for PBXNativeTarget "CDVCameraLibTests" */;
+			buildPhases = (
+				7E9F519B19DA102000DA31AC /* Sources */,
+				7E9F519C19DA102000DA31AC /* Frameworks */,
+				7E9F519D19DA102000DA31AC /* Resources */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				7E9F51AD19DA10DE00DA31AC /* PBXTargetDependency */,
+			);
+			name = CDVCameraLibTests;
+			productName = CDVCameraLibTests;
+			productReference = 7E9F519F19DA102000DA31AC /* CDVCameraLibTests.xctest */;
+			productType = "com.apple.product-type.bundle.unit-test";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		7E9F517219DA09CE00DA31AC /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0610;
+				TargetAttributes = {
+					7E9F519419DA102000DA31AC = {
+						CreatedOnToolsVersion = 6.0;
+					};
+					7E9F519E19DA102000DA31AC = {
+						CreatedOnToolsVersion = 6.0;
+					};
+				};
+			};
+			buildConfigurationList = 7E9F517519DA09CE00DA31AC /* Build configuration list for PBXProject "CDVCameraTest" */;
+			compatibilityVersion = "Xcode 3.2";
+			developmentRegion = English;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+			);
+			mainGroup = 7E9F517119DA09CE00DA31AC;
+			productRefGroup = 7E9F517D19DA0A0A00DA31AC /* Products */;
+			projectDirPath = "";
+			projectReferences = (
+				{
+					ProductGroup = 7E9F518C19DA0F8300DA31AC /* Products */;
+					ProjectRef = 7E9F518B19DA0F8300DA31AC /* CordovaLib.xcodeproj */;
+				},
+			);
+			projectRoot = "";
+			targets = (
+				7E9F519419DA102000DA31AC /* CDVCameraLib */,
+				7E9F519E19DA102000DA31AC /* CDVCameraLibTests */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXReferenceProxy section */
+		7E9F519019DA0F8300DA31AC /* libCordova.a */ = {
+			isa = PBXReferenceProxy;
+			fileType = archive.ar;
+			path = libCordova.a;
+			remoteRef = 7E9F518F19DA0F8300DA31AC /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
+/* End PBXReferenceProxy section */
+
+/* Begin PBXResourcesBuildPhase section */
+		7E9F519D19DA102000DA31AC /* Resources */ = {
+			isa = PBXResourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+		7E9F519119DA102000DA31AC /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				30486FF91A40DCC70065C233 /* CDVCamera.m in Sources */,
+				30486FFB1A40DCC70065C233 /* UIImage+CropScaleOrientation.m in Sources */,
+				30486FFA1A40DCC70065C233 /* CDVJpegHeaderWriter.m in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		7E9F519B19DA102000DA31AC /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				7E9F51B119DA114400DA31AC /* CameraTest.m in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+		30486FFD1A40DCE80065C233 /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			name = CordovaLib;
+			targetProxy = 30486FFC1A40DCE80065C233 /* PBXContainerItemProxy */;
+		};
+		7E9F51AD19DA10DE00DA31AC /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = 7E9F519419DA102000DA31AC /* CDVCameraLib */;
+			targetProxy = 7E9F51AC19DA10DE00DA31AC /* PBXContainerItemProxy */;
+		};
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+		7E9F517619DA09CE00DA31AC /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ONLY_ACTIVE_ARCH = YES;
+			};
+			name = Debug;
+		};
+		7E9F517719DA09CE00DA31AC /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+			};
+			name = Release;
+		};
+		7E9F51A419DA102000DA31AC /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = NO;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					"$(inherited)",
+				);
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				HEADER_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(TARGET_BUILD_DIR)/usr/local/lib/include\"",
+					"\"$(OBJROOT)/UninstalledProducts/include\"",
+					"\"$(BUILT_PRODUCTS_DIR)\"",
+				);
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+				MTL_ENABLE_DEBUG_INFO = YES;
+				ONLY_ACTIVE_ARCH = YES;
+				OTHER_LDFLAGS = "-ObjC";
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = iphoneos;
+				SKIP_INSTALL = YES;
+			};
+			name = Debug;
+		};
+		7E9F51A519DA102000DA31AC /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = YES;
+				ENABLE_NS_ASSERTIONS = NO;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				HEADER_SEARCH_PATHS = (
+					"$(inherited)",
+					"\"$(TARGET_BUILD_DIR)/usr/local/lib/include\"",
+					"\n\"$(OBJROOT)/UninstalledProducts/include\"\n\"$(BUILT_PRODUCTS_DIR)\"",
+				);
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+				MTL_ENABLE_DEBUG_INFO = NO;
+				OTHER_LDFLAGS = "-ObjC";
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = iphoneos;
+				SKIP_INSTALL = YES;
+				VALIDATE_PRODUCT = YES;
+			};
+			name = Release;
+		};
+		7E9F51A719DA102000DA31AC /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = NO;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(SDKROOT)/Developer/Library/Frameworks",
+					"$(inherited)",
+				);
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					"$(inherited)",
+				);
+				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				INFOPLIST_FILE = CDVCameraLibTests/Info.plist;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+				MTL_ENABLE_DEBUG_INFO = YES;
+				ONLY_ACTIVE_ARCH = YES;
+				OTHER_LDFLAGS = (
+					"$(inherited)",
+					"-framework",
+					XCTest,
+					"-all_load",
+					"-ObjC",
+				);
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = iphoneos;
+			};
+			name = Debug;
+		};
+		7E9F51A819DA102000DA31AC /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = YES;
+				ENABLE_NS_ASSERTIONS = NO;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				FRAMEWORK_SEARCH_PATHS = (
+					"$(SDKROOT)/Developer/Library/Frameworks",
+					"$(inherited)",
+				);
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				INFOPLIST_FILE = CDVCameraLibTests/Info.plist;
+				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+				MTL_ENABLE_DEBUG_INFO = NO;
+				OTHER_LDFLAGS = (
+					"$(inherited)",
+					"-framework",
+					XCTest,
+					"-all_load",
+					"-ObjC",
+				);
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = iphoneos;
+				VALIDATE_PRODUCT = YES;
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		7E9F517519DA09CE00DA31AC /* Build configuration list for PBXProject "CDVCameraTest" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				7E9F517619DA09CE00DA31AC /* Debug */,
+				7E9F517719DA09CE00DA31AC /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		7E9F51A319DA102000DA31AC /* Build configuration list for PBXNativeTarget "CDVCameraLib" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				7E9F51A419DA102000DA31AC /* Debug */,
+				7E9F51A519DA102000DA31AC /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		7E9F51A619DA102000DA31AC /* Build configuration list for PBXNativeTarget "CDVCameraLibTests" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				7E9F51A719DA102000DA31AC /* Debug */,
+				7E9F51A819DA102000DA31AC /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 7E9F517219DA09CE00DA31AC /* Project object */;
+}
diff --git a/tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 0000000..98498f8
--- /dev/null
+++ b/tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+   version = "1.0">
+   <FileRef
+      location = "self:CDVCameraTest.xcodeproj">
+   </FileRef>
+</Workspace>
diff --git a/tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/project.xcworkspace/xcshareddata/CDVCameraTest.xccheckout b/tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/project.xcworkspace/xcshareddata/CDVCameraTest.xccheckout
new file mode 100644
index 0000000..2a654cb
--- /dev/null
+++ b/tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/project.xcworkspace/xcshareddata/CDVCameraTest.xccheckout
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>IDESourceControlProjectFavoriteDictionaryKey</key>
+	<false/>
+	<key>IDESourceControlProjectIdentifier</key>
+	<string>6BE9AD73-1B9F-4362-98D7-DC631BEC6185</string>
+	<key>IDESourceControlProjectName</key>
+	<string>CDVCameraTest</string>
+	<key>IDESourceControlProjectOriginsDictionary</key>
+	<dict>
+		<key>BEF5A5D0FF64801E558286389440357A9233D7DB</key>
+		<string>https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git</string>
+	</dict>
+	<key>IDESourceControlProjectPath</key>
+	<string>tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj</string>
+	<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
+	<dict>
+		<key>BEF5A5D0FF64801E558286389440357A9233D7DB</key>
+		<string>../../../../..</string>
+	</dict>
+	<key>IDESourceControlProjectURL</key>
+	<string>https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git</string>
+	<key>IDESourceControlProjectVersion</key>
+	<integer>111</integer>
+	<key>IDESourceControlProjectWCCIdentifier</key>
+	<string>BEF5A5D0FF64801E558286389440357A9233D7DB</string>
+	<key>IDESourceControlProjectWCConfigurations</key>
+	<array>
+		<dict>
+			<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
+			<string>public.vcs.git</string>
+			<key>IDESourceControlWCCIdentifierKey</key>
+			<string>BEF5A5D0FF64801E558286389440357A9233D7DB</string>
+			<key>IDESourceControlWCCName</key>
+			<string>cordova-plugin-camera</string>
+		</dict>
+	</array>
+</dict>
+</plist>
diff --git a/tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/xcshareddata/xcschemes/CDVCameraLib.xcscheme b/tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/xcshareddata/xcschemes/CDVCameraLib.xcscheme
new file mode 100644
index 0000000..f0a8304
--- /dev/null
+++ b/tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/xcshareddata/xcschemes/CDVCameraLib.xcscheme
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   LastUpgradeVersion = "0610"
+   version = "1.3">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "YES"
+            buildForArchiving = "YES"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "7E9F519419DA102000DA31AC"
+               BuildableName = "libCDVCameraLib.a"
+               BlueprintName = "CDVCameraLib"
+               ReferencedContainer = "container:CDVCameraTest.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      buildConfiguration = "Debug">
+      <Testables>
+      </Testables>
+   </TestAction>
+   <LaunchAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Debug"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      allowLocationSimulation = "YES">
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "7E9F519419DA102000DA31AC"
+            BuildableName = "libCDVCameraLib.a"
+            BlueprintName = "CDVCameraLib"
+            ReferencedContainer = "container:CDVCameraTest.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </LaunchAction>
+   <ProfileAction
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Release"
+      debugDocumentVersioning = "YES">
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "7E9F519419DA102000DA31AC"
+            BuildableName = "libCDVCameraLib.a"
+            BlueprintName = "CDVCameraLib"
+            ReferencedContainer = "container:CDVCameraTest.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>
diff --git a/tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/xcshareddata/xcschemes/CDVCameraLibTests.xcscheme b/tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/xcshareddata/xcschemes/CDVCameraLibTests.xcscheme
new file mode 100644
index 0000000..b5d2603
--- /dev/null
+++ b/tests/ios/CDVCameraTest/CDVCameraTest.xcodeproj/xcshareddata/xcschemes/CDVCameraLibTests.xcscheme
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+   LastUpgradeVersion = "0610"
+   version = "1.3">
+   <BuildAction
+      parallelizeBuildables = "YES"
+      buildImplicitDependencies = "YES">
+      <BuildActionEntries>
+         <BuildActionEntry
+            buildForTesting = "YES"
+            buildForRunning = "YES"
+            buildForProfiling = "NO"
+            buildForArchiving = "NO"
+            buildForAnalyzing = "YES">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "7E9F519E19DA102000DA31AC"
+               BuildableName = "CDVCameraLibTests.xctest"
+               BlueprintName = "CDVCameraLibTests"
+               ReferencedContainer = "container:CDVCameraTest.xcodeproj">
+            </BuildableReference>
+         </BuildActionEntry>
+      </BuildActionEntries>
+   </BuildAction>
+   <TestAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      buildConfiguration = "Debug">
+      <Testables>
+         <TestableReference
+            skipped = "NO">
+            <BuildableReference
+               BuildableIdentifier = "primary"
+               BlueprintIdentifier = "7E9F519E19DA102000DA31AC"
+               BuildableName = "CDVCameraLibTests.xctest"
+               BlueprintName = "CDVCameraLibTests"
+               ReferencedContainer = "container:CDVCameraTest.xcodeproj">
+            </BuildableReference>
+         </TestableReference>
+      </Testables>
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "7E9F519E19DA102000DA31AC"
+            BuildableName = "CDVCameraLibTests.xctest"
+            BlueprintName = "CDVCameraLibTests"
+            ReferencedContainer = "container:CDVCameraTest.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+   </TestAction>
+   <LaunchAction
+      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+      launchStyle = "0"
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Debug"
+      ignoresPersistentStateOnLaunch = "NO"
+      debugDocumentVersioning = "YES"
+      allowLocationSimulation = "YES">
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "7E9F519E19DA102000DA31AC"
+            BuildableName = "CDVCameraLibTests.xctest"
+            BlueprintName = "CDVCameraLibTests"
+            ReferencedContainer = "container:CDVCameraTest.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+      <AdditionalOptions>
+      </AdditionalOptions>
+   </LaunchAction>
+   <ProfileAction
+      shouldUseLaunchSchemeArgsEnv = "YES"
+      savedToolIdentifier = ""
+      useCustomWorkingDirectory = "NO"
+      buildConfiguration = "Release"
+      debugDocumentVersioning = "YES">
+      <MacroExpansion>
+         <BuildableReference
+            BuildableIdentifier = "primary"
+            BlueprintIdentifier = "7E9F519E19DA102000DA31AC"
+            BuildableName = "CDVCameraLibTests.xctest"
+            BlueprintName = "CDVCameraLibTests"
+            ReferencedContainer = "container:CDVCameraTest.xcodeproj">
+         </BuildableReference>
+      </MacroExpansion>
+   </ProfileAction>
+   <AnalyzeAction
+      buildConfiguration = "Debug">
+   </AnalyzeAction>
+   <ArchiveAction
+      buildConfiguration = "Release"
+      revealArchiveInOrganizer = "YES">
+   </ArchiveAction>
+</Scheme>
diff --git a/tests/ios/README.md b/tests/ios/README.md
new file mode 100644
index 0000000..631ae2c
--- /dev/null
+++ b/tests/ios/README.md
@@ -0,0 +1,21 @@
+# iOS Tests for CDVCamera
+
+You need to install `node.js` to pull in `cordova-ios`.
+
+First install cordova-ios:
+
+    npm install
+
+... in the current folder.
+
+
+# Testing from Xcode
+
+1. Launch the `CDVCameraTest.xcworkspace` file.
+2. Choose "CDVCameraLibTests" from the scheme drop-down menu
+3. Click and hold on the `Play` button, and choose the `Wrench` icon to run the tests
+
+
+# Testing from the command line
+
+    npm test
diff --git a/tests/ios/package.json b/tests/ios/package.json
new file mode 100644
index 0000000..84bd9ec
--- /dev/null
+++ b/tests/ios/package.json
@@ -0,0 +1,13 @@
+{
+    "name": "cordova-plugin-camera-test-ios",
+    "version": "1.0.0",
+    "description": "iOS Unit Tests for Camera Plugin",
+    "author": "Apache Software Foundation",
+    "license": "Apache Version 2.0",
+    "dependencies": {
+        "cordova-ios": "^3.7.0"
+    },
+    "scripts": {
+        "test": "xcodebuild -scheme CordovaLib && xcodebuild test -scheme CDVCameraLibTests -destination 'platform=iOS Simulator,name=iPhone 5'"
+    }    
+}
\ No newline at end of file