How to get a photo from a photo library using PhoneGap on iOS?

I use 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 am using iOS 7 (7.0.4) on iPhone 5 and PhoneGap 3.3.0. No matter what I do, he always raises the camera. What am I doing wrong?

+7
ios ios7 cordova cordova-3
source share
2 answers

I think I found it:

 soureType: Camera.PictureSourceType.PHOTOLIBRARY, 

it should be:

 sourceType: Camera.PictureSourceType.PHOTOLIBRARY, 

There is a typo in the original type. Maybe this is so?

+15
source share

Below is the code for the access gallery photos:

  Camera.sourceType = Camera.PictureSourceType.PHOTOLIBRARY or Camera.PictureSourceType.SAVEDPHOTOALBUM, 

a photo selection dialog will appear, from which you can select a photo from the album.

-2
source share

All Articles