You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Shazron Abdullah (Commented) (JIRA)" <ji...@apache.org> on 2012/04/03 02:23:22 UTC

[jira] [Commented] (CB-391) navigator.camera.getPicture() crashing on iOS after memory warning

    [ https://issues.apache.org/jira/browse/CB-391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13244872#comment-13244872 ] 

Shazron Abdullah commented on CB-391:
-------------------------------------

Good observation @YuanKai, and possibly what is happening. What I'm thinking is, since it is EXC_BAD_ACCESS, this usually means a message was sent to an object that was de-allocated, which I believe is the .webView referenced in the plugin (the only webView in the app). The Camera plugin is trying to send this message to the webView property, and it crashes. 

To prevent this crash, the application delegate should set the webView and the webView delegate to nil in viewDidUnload https://github.com/apache/incubator-cordova-ios/blob/master/CordovaLib/Classes/CDVViewController.m#L336 . This would prevent the crash, but of course all your workflow is gone, and most likely not recoverable. Because of the memory purge, it should call viewDidUnload, then viewDidLoad again, and your app should re-load again, starting fresh.

Ignoring didReceiveMemoryWarning is just a stay of execution, ignored often enough the iOS watchdog will kill your app anyway. Note that all running apps (including Apple's) get this message, not just the current app. 
                
> navigator.camera.getPicture() crashing on iOS after memory warning
> ------------------------------------------------------------------
>
>                 Key: CB-391
>                 URL: https://issues.apache.org/jira/browse/CB-391
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 1.5.0
>         Environment: 2 x iPhone 4S, iOS 5.1. Can't replicate on simulator or iHone 3GS with iOS 5.0.1
>            Reporter: Richard Kimber
>            Assignee: Shazron Abdullah
>         Attachments: Wulvern_2012-03-27-141033_Richs-iPhone.crash
>
>
> getPicture has become very unstable on previously working code, affecting both Phonegap 1.4.1 and Cordova 1.5.0. Contributing factors, since last working build I have upgraded Xcode to 4.3.2 (from whatever the last version was) and iPhone to iOS 5.1 from 5.0.1.
> Memory warning is received on displaying camera, app crashes when you select 'use'. Restarting device usually resolves problem for a limited amount of time. Problem is intermittent and sometime difficult to replicate. Selecting from Photo library works fine.
> Options used:
> 		var options = {
> 			quality: 40,
> 			sourceType: Camera.DestinationType.FILE_URI
> 		};
> See https://groups.google.com/forum/?hl=en?hl%3Den&fromgroups#!topic/phonegap/ZLbw0s4JREs for more details.
> See attached for example crash log.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira