Environment: iOS 7.0.3 & 6.1.3, tested on iPhone devices (several separate devices). Ti v 3.1.3 with Alloy 1.2.2.
I'm having trouble with my app freezing when taking a photo on the device. Selecting a photo from the gallery works without a problem, but when taking a photo, the app freezes on the move and scale screen - seemingly, after tapping the "Use" button. My code is as follows:
$.avatar.addEventListener("click", function() {
var opts = {
cancel : 2,
options : ['Take a Photo', 'Select from Gallery', 'Cancel'],
selectedIndex : 2,
destructive : 0,
title : 'Set a Profile Photo:'
};
var dialog = Ti.UI.createOptionDialog(opts);
dialog.show();
dialog.addEventListener("click", function(e) {
switch(e.index) {
case(0):
Titanium.Media.showCamera({
allowEditing : true,
success : function(event) {
$.avatar.status = "new";
$.avatar.image = event.media;
},
error : function(event) {
console.log(event);
}
});
case(1):
Titanium.Media.openPhotoGallery({
allowEditing : true,
success : function(event) {
$.avatar.status = "new";
$.avatar.image = event.media;
},
error : function(event) {
console.log(event);
}
});
}
});
});
The desired behavior here is that the user taps on their avatar, which opens the option menu. They then tap "Take a photo", which opens the camera allowing them to take the photo and crop it. After tapping "Use", that photo is then displayed in the $.avatar ImageView.
I've been able to reproduce this on every device I've tested on, across multiple iOS versions. Is this a bug in Alloy or TI, or am I doing something overtly wrong here? Thanks!