Hey All,
I can't seem to get the camera.getPicture function to work.
I'm using Xcode 4.3.1 on snow leopard.
Phonegap 1.1.0 with JQTouch.
I've tried on actual devices: iPod (4th gen with camera) and iPad2
(with camera).
I don't get any error messages in console or anything.
If I change it to use the capture.captureImage API then the camera
does indeed open and I can save a photo to the camera roll.
But for some reason camera.getPicture is just not working. I'd like to
be able to grab the file URIs from the albums and camera roll.
I added an alert just before navigator.camera.getPicture in the
getPhoto function and it shows up. When I put the alert after it I
get no alert.
I'm using the code straight from
http://docs.phonegap.com/en/1.1.0/phonegap_camera_camera.md.html#Camera
Any suggestions on how to go about troubleshooting this?
function onDeviceReady() {
pictureSource=navigator.camera.PictureSourceType;
destinationType=navigator.camera.DestinationType;
}
function getPhoto(source) {
// Retrieve image file location from specified source
navigator.camera.getPicture(onPhotoURISuccess, onFail,
{ quality: 50,
destinationType: destinationType.FILE_URI,
sourceType: source });
}
// Called if something bad happens.
//
function onFail(message) {
alert('Failed because: ' + message);
}
function onPhotoURISuccess(imageURI) {
alert(imageURI);
}
And in html:
<button onclick="getPhoto(pictureSource.PHOTOLIBRARY);">From Photo
Library</button><br>
<button onclick="getPhoto(pictureSource.SAVEDPHOTOALBUM);">From
Photo Album</button><br>
Thanks,
Scott