freshplanet / ANE-ImagePicker

Air Native Extension for mobile camera and gallery features (iOS + Android)
Apache License 2.0
80 stars 48 forks source link

Crash when displayCamera was called on iPad1 #1

Closed aliokan closed 11 years ago

aliokan commented 11 years ago

Hello,

I just call : AirImagePicker.getInstance().displayCamera(callbackPicture);

Below a console copy : Dec 18 14:55:28 unknown upst_ipad[14813] : * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Source type 1 not available' * First throw call stack: (0x358a588f 0x334c9259 0x3320f08b 0x58c603 0x58ccad 0x3e7f74 0x264b9c 0x52ccfb 0x52ca97 0x52bc6b 0x4f5e07 0x52c655 0x52bc6b 0x4f5e07 0x52c655 0x52c443 0x52bc6b 0x4f5e07 0x52c655 0x52c443 0x4fdc13 0x4f57b5 0x52b6a3 0x1e2578 0x1e20e4 0x1e1be4 0x1e2aa8 0x2a5594 0x2a5fdc 0x2a5da8 0x2a5908 0xb2ea0 0xb38e0 0xe13e0 0xe1394 0x17bdf8 0x17c36c 0x3434d0 0x17ed44 0xe02d8 0xe0490 0xf74c8 0xf7a04 0x10168 0x102b0 0x108e8 0x34ccb933 0x35879a33 0x35879699 0x3587826f 0x357fb4a5 0x357fb36d 0x33596439 0x32fd3cd5 0x100990 0x58c3ec) Dec 18 14:55:28 unknown UIKitApplication:net.geturl.upst[0xfcd1][14813] : terminate called throwing an exception Dec 18 14:55:28 unknown kernel[0] : launchd[14815] Builtin profile: PasteBoard (sandbox)

Dec 18 14:55:28 unknown ReportCrash[14816] : Formulating crash report for process upst_ipad[14813] Dec 18 14:55:28 unknown com.apple.launchd[1] : (UIKitApplication:net.geturl.upst[0xfcd1]) Job appears to have crashed: Abort trap: 6 Dec 18 14:55:28 unknown SpringBoard[64] : Application 'UPST' exited abnormally with signal 6: Abort trap: 6 Dec 18 14:55:29 unknown ReportCrash[14816] : Saved crashreport to /var/mobile/Library/Logs/CrashReporter/upst_ipad_2012-12-18-145528_iPad-de-***.plist using uid: 0 gid: 0, synthetic_euid: 501 egid: 0

For information, displayImagePicker run good.

I test on a iPad 1 iOS5.1.1, compile with Flex4.6 + AIR3.6 ASC2.0 to FDT on Mac osX.7.5

If you want, I can send you the crash repport.

cheers, Laurent

ataugeron commented 11 years ago

Hi,

This is due to the fact that there is no camera on this device. You should call isCameraAvailable() before calling displayCamera(). That being said, I agree the method should fail more gracefully.

Please note that this ANE is not actively developed anymore since there are Actionscript APIs that allow to do the same. These APIs are CameraUI and CameraRoll.

On Tuesday, December 18, 2012, aliokan wrote:

Hello,

I just call : AirImagePicker.getInstance().displayCamera(callbackPicture);

Below a console copy : Dec 18 14:55:28 unknown upst_ipad[14813] : * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Source type 1 not available' * First throw call stack: (0x358a588f 0x334c9259 0x3320f08b 0x58c603 0x58ccad 0x3e7f74 0x264b9c 0x52ccfb 0x52ca97 0x52bc6b 0x4f5e07 0x52c655 0x52bc6b 0x4f5e07 0x52c655 0x52c443 0x52bc6b 0x4f5e07 0x52c655 0x52c443 0x4fdc13 0x4f57b5 0x52b6a3 0x1e2578 0x1e20e4 0x1e1be4 0x1e2aa8 0x2a5594 0x2a5fdc 0x2a5da8 0x2a5908 0xb2ea0 0xb38e0 0xe13e0 0xe1394 0x17bdf8 0x17c36c 0x3434d0 0x17ed44 0xe02d8 0xe0490 0xf74c8 0xf7a04 0x10168 0x102b0 0x108e8 0x34ccb933 0x35879a33 0x35879699 0x3587826f 0x357fb4a5 0x357fb36d 0x33596439 0x32fd3cd5 0x100990 0x58c3ec) Dec 18 14:55:28 unknown UIKitApplication:net.geturl.upst[0xfcd1][14813] : terminate called throwing an exception Dec 18 14:55:28 unknown kernel[0] : launchd[14815] Builtin profile: PasteBoard (sandbox)

Dec 18 14:55:28 unknown ReportCrash[14816] : Formulating crash report for process upst_ipad[14813] Dec 18 14:55:28 unknown com.apple.launchd[1] : (UIKitApplication:net.geturl.upst[0xfcd1]) Job appears to have crashed: Abort trap: 6 Dec 18 14:55:28 unknown SpringBoard[64] : Application 'UPST' exited abnormally with signal 6: Abort trap: 6 Dec 18 14:55:29 unknown ReportCrash[14816] : Saved crashreport to /var/mobile/Library/Logs/CrashReporter/upst_ipad_2012-12-18-145528_iPad-de-***.plist using uid: 0 gid: 0, synthetic_euid: 501 egid: 0

For information, displayImagePicker run good.

I test on a iPad 1 iOS5.1.1, compile with Flex4.6 + AIR3.6 ASC2.0 to FDT on Mac osX.7.5

If you want, I can send you the crash repport.

cheers, Laurent

— Reply to this email directly or view it on GitHubhttps://github.com/freshplanet/ANE-ImagePicker/issues/1.

Alexis

aliokan commented 11 years ago

Effectively! It's time to go to bed.

Thx a lot for CameraUI and CameraRoll information :)

arenagroove commented 11 years ago

Hi,

I have been playing around with this extension a little bit just for curiosity and to see and compare it with the CameraUI built in AIR. Both, built in CameraUI and ANE-ImagePicker when used with Stage3D, Starling or any other framework that takes advantage of the GPU in iOS make them to trigger a context loss. I guess this is an unavoidable problem.

ataugeron commented 11 years ago

It's an excellent question that we are also investigating. Please let me know if you find anything interesting regarding this issue. I'll do the same :-)

On Sunday, February 17, 2013, arenagroove wrote:

Hi,

I have been playing around with this extension a little bit just for curiosity and to see and compare it with the CameraUI built in AIR. Both, built in CameraUI and ANE-ImagePicker when used with Stage3D, Starling or any other framework that takes advantage of the GPU in iOS make them to trigger a context loss. I guess this is an unavoidable problem.

— Reply to this email directly or view it on GitHubhttps://github.com/freshplanet/ANE-ImagePicker/issues/1#issuecomment-13691679.

Alexis

arenagroove commented 11 years ago

Hi ataugeron.

There are some interesting posts I found in Starling forum regarding context loss, it looks to me like something to live with:

http://forum.starling-framework.org/topic/lost-device-context-on-iphone http://forum.starling-framework.org/topic/iads-on-ipad-1-causing-crashes#post-16890

Luis

http://forum.starling-framework.org/topic/lost-device-context-on-iphone

ataugeron commented 11 years ago

@arenagroove I just pushed a new version with an option to set an overlay (BitmapData) that will replace the white screen. It doesn't solve the problem for people who can't use Starling's handleLostContext(), but for others it allows to pass a screenshot of the current UI, to display while waiting for the new context.

Here's what I do to display a screenshot of the Starling stage:

// Clear the buffers
var stage:Stage = Starling.current.stage;
var support:RenderSupport = new RenderSupport();
RenderSupport.clear(stage.color, 1.0);
support.setOrthographicProjection(0, 0, stage.width, stage.height);
stage.render(support, 1.0);
support.finishQuadBatch();

// Take a screenshot of current screen
var screenshot:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);
Starling.context.drawToBitmapData(screenshot);

// Setup ANE
AirImagePicker.getInstance().setupStage3DOverlay(Starling.current.stage3D, screenshot);

// Display camera UI
AirImagePicker.getInstance().displayCamera(callback, crop);

Hope this helps...

fukhaos commented 11 years ago

This code for handleLostContext, set screenshot with wrong size in app landscape and not fullScreen.

arenagroove commented 11 years ago

Hi, I had the chance to test the new overlay functionality (I have been very busy latelly). Somehow solves the issue with loosing the context but not 100%. There are various scenarios where things go wrong. Having an iOS app with non fullscreen makes the launching of the device camera to flash (I think it shows the app stage color) before it shows the overlay (always testing in Portrait mode and iPhone4) and also it pixelates the screenshot taken in Starling (like it is streching it?, not sure...). Testing with fullscreenmode all seems to work nicely.

Also I have notice something else which already happens with Adobe's CameraUI. If you launch the camera in IOS and before taking any picture putting the app in the background and coming back (eg: click the device home button and then open the app again) freezes the camera in the shooter. At this point clicking Cancel is ok but clicking the take photo button (camera icon) freezes the app for ever.

ataugeron commented 11 years ago

It's interesting, I'm testing on a non-fullscreen portrait app and I don't see the "flash" issue you're talking about... Though I do see the "pixelated overlay" issue. Anyway, I'll let you know if I find something...