Search code examples
ioscordovaios7cordova-3

How to get a picture from the photo library with PhoneGap on iOS?


I'm using the following code to try to select a photo from the iOS photo library:

navigator.camera.getPicture(this.onCaptureSuccess, this.onCaptureFail, {
    allowEdit: true,
    correctOrientation: true,
    destinationType: Camera.DestinationType.FILE_URI,
    soureType: Camera.PictureSourceType.PHOTOLIBRARY,
    targetHeight: 315,
    targetWidth: 320
});

I'm using iOS 7 (7.0.4) on an iPhone 5s and PhoneGap 3.3.0. No matter what I do it always brings the camera up. What am I doing wrong?


Solution

  • Think I found it:

    soureType: Camera.PictureSourceType.PHOTOLIBRARY,
    

    should be:

    sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
    

    sourceType has a typo in it. Maybe thats it?