Description
When using Ti.Media.showCamera and setting saveToPhotoGallery to true an error will be thrown after the user has taken a photo. This is fixed by adding the following capabilities
<Capability Name="picturesLibrary" />
<Capability Name="videosLibrary" />
function showCamera() {
Titanium.Media.showCamera({
success : function(event) {
// called when media returned from the camera
Ti.API.debug('Photo taken successfully');
},
cancel : function() {
// called when user cancels taking a picture
Ti.API.debug('Photo cancelled.');
},
error : function(error) {
Ti.API.debug('Photo errored.');
// called when there's an error
var a = Titanium.UI.createAlertDialog({
title : "Camera"
});
a.setMessage(JSON.stringify(error));
a.show();
console.log(JSON.stringify(error));
},
saveToPhotoGallery : true
});
}
if (Ti.Media.hasCameraPermissions()) {
showCamera();
} else {
Ti.Media.requestCameraPermissions(function(e) {
if (e.success === true) {
showCamera();
} else {
alert("Access denied, error: " + e.error);
}
});
}
Steps to reproduce
Add the code above to an existing app.js
Build for Windows appc run -p windows -T wp-device
Take a photo
Tap the tick to save the photo
Actual result
Error is thrown
Expected result
Error should not be thrown
I would resolve this as "won't fix", because it is difficult to detect if target property (saveToPhotoGallery) is actually true (or not) at compile time. We need to manually set required permission in this case.