Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-18214] iOS8: Titanium.Media.showCamera unexpected behaviour on AdHoc distribution

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-12-17T20:44:58.000+0000
Affected Version/sn/a
Fix Version/sRelease 3.5.0, Release 4.0.0
ComponentsiOS
Labelsn/a
ReporterEduardo Gomez
AssigneeVishal Duggal
Created2014-12-16T17:07:38.000+0000
Updated2014-12-23T16:37:08.000+0000

Description

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}

Comments

  1. Eric Merriman 2014-12-16

    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.
  2. Eric Merriman 2014-12-16

    Ok, after a bit more research, I think I have a pattern: iOS 8.1.1 or greater: Snapshot error which looks like this:
       Dec 16 13:07:54 Data-nerd timob18214[386] <Error>: assertion failed: 12B435: libxpc.dylib + 51955 [6D3E948A-39BD-3548-AA90-38575933BDEF]: 0x7d
       Dec 16 13:07:54 Data-nerd Unknown[386] <Error>: 
       Dec 16 13:07:56 Data-nerd timob18214[386] <Warning>: 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.
       
    Retina display = true: NaN which looks like this:
       Dec 16 13:16:57 Garfunkel timob18214[251] <Warning>: [INFO] Image Captured, Dims: undefined,undefined Aspect Ratio: NaN
       Dec 16 13:16:57 Garfunkel timob18214[251] <Warning>: [INFO] Image Captured, Dims: undefined,undefined Aspect Ratio: NaN
       
  3. Eric Merriman 2014-12-16

    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
  4. Vishal Duggal 2014-12-17

    Pulls pending master - https://github.com/appcelerator/titanium_mobile/pull/6497 3_5_X - https://github.com/appcelerator/titanium_mobile/pull/6498
  5. Eric Merriman 2014-12-17

    Wrote TIMOB-18249 to track the other console output not related to the NaN issue.
  6. Eric Merriman 2014-12-17

    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
  7. Vishal Duggal 2014-12-23

    Additional PR's merged master - https://github.com/appcelerator/titanium_mobile/pull/6523 3_5_X - https://github.com/appcelerator/titanium_mobile/pull/6524

JSON Source