Issue Description
Invoking Ti.Media.showCamera works perfect if we do a command line build of our app on device. If we take the provided sample app and then publish AdHoc then it fails.
Steps to reproduce
1. Launch sample app (Run As > Device)
2. Hit Camera Button to Take a photograph
3. Hit Use Photo and monitor logs
4. Image Dimensions are correctly returned (running App on device iPhone5s):
{quote}
[INFO] : Image Captured, Dims 2448,3264 Aspect Ratio: 0.75
[INFO] : Image Captured, Dims 2448,3264 Aspect Ratio: 0.75
{quote}
5. Repeat all steps under Ad Hoc mode.
6. Logs are slightly different now:
{quote}
[ERROR] : assertion failed: 12A366: libxpc.dylib + 71820 [4BC9CA3D-4DEE-314C-ADBF-53BDCEEFE45C]: 0x7d
[ERROR] : Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.
[ERROR] : Image Captured, Dims: undefined,undefined Aspect Ratio: NaN
[ERROR] : Image Captured, Dims: undefined,undefined Aspect Ratio: NaN
{quote}
Test Case
(function() {
Titanium.Media.showCamera({
success : function(event) {
var capturedImage = event.media;
Ti.API.info('Image Captured, Dims: ' + event.media.width + ',' + event.media.height + " Aspect Ratio: " + event.media.width / event.media.height);
Ti.API.info('Image Captured, Dims: ' + capturedImage.width + ',' + capturedImage.height + " Aspect Ratio: " + capturedImage.width / capturedImage.height);
},
cancel : function() {
},
error : function(error) {
},
saveToPhotoGallery : false,
allowEditing : false,
mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO],
showControls : true,
autohide : false
});
})();
Device Output (Ad Hoc Distribution)
iPhone 4 iOS7.1
{quote}
Dec 16 09:46:46 lAlO wifid[15]
:
Dec 16 09:46:51 lAlO Super.Simple[208] : [INFO] Image Captured, Dims: 1936,2592 Aspect Ratio: 0.7469135802469136
Dec 16 09:46:51 lAlO Super.Simple[208] : [INFO] Image Captured, Dims: 1936,2592 Aspect Ratio: 0.7469135802469136
{quote}
iPhone 5s iOS 8.1
{quote}
Dec 16 10:36:41 iPhone Super.Simple[253] : [INFO] Image Captured, Dims: undefined,undefined Aspect Ratio: NaN
Dec 16 10:36:41 iPhone Super.Simple[253] : [INFO] Image Captured, Dims: undefined,undefined Aspect Ratio: NaN
{quote}
Able to reproduce with iOS 8.0.2 Device (iPhone 5s) with the following: SDK: 3.5.0.v20141205222614 <- reported config SDK: 3.5.0.v20141215113314 <- latest 3_5_X Unable to reproduce on iOS 8.1.1 Device (iPhone 4s) with the following: SDK: 3.5.0.v20141215113314 Looks like a form-factor related error. Will continue to investigate.
Ok, after a bit more research, I think I have a pattern: iOS 8.1.1 or greater: Snapshot error which looks like this:
Retina display = true: NaN which looks like this:
And a final note. Up until now, all testing was packaged ad-hoc. With "run on device", I saw a difference in behavior in some cases: NaN not present in device build, present in Ad-hoc for: iPhone 5s - iPad Mini Retina 7.0.3 - iPhone 6+ - This is actually related to 64 bit capable hardware. On 32 bit only hardware, you don't get the NaN
Pulls pending master - https://github.com/appcelerator/titanium_mobile/pull/6497 3_5_X - https://github.com/appcelerator/titanium_mobile/pull/6498
Wrote TIMOB-18249 to track the other console output not related to the NaN issue.
Verified fixed in SDK 3.5.0.v2014121712411 using the following mix of 64 bit and non hardware: iPhone 4s iOS 8.1.1 iPhone 5c iOS 7.1 iPhone 5s iOS 8.0.2 iPhone 6+ iOS 8.1 iPad mini 1st gen iOS 8.1 iPad Air 2 iOS 8.2 beta 2
Additional PR's merged master - https://github.com/appcelerator/titanium_mobile/pull/6523 3_5_X - https://github.com/appcelerator/titanium_mobile/pull/6524