Google Groups

Re: crashing on iOS, ARC errors and memory warnings.

Myke Mar 29, 2012 7:55 PM
Posted in group: phonegap
This worked for me - excellent find!

On Tuesday, March 27, 2012 4:31:01 AM UTC-4, Jonathan Hobson wrote:
We've been struggling with this issue for weeks (sometimes it would crash even when trying to take a 10x10px image) and I think I've finally found a solution:

If your app responds to didReceiveMemoryWarning you're telling iOS that you're OK to have all your memory taken away from you and used for other things.

Go into your main view controller and comment out the call to [super didReceiveMemoryWarning];

- (void)didReceiveMemoryWarning
    // Releases the view if it doesn't have a superview.
    // [super didReceiveMemoryWarning];
    // Release any cached data, images, etc that aren't in use.

Which tells iOS to keep its hands off your memory. I think PhoneGap needs to do some bug fixing to properly support memory warnings, which would be good iOS practice, but as our app is only using 2.5mb RAM I don't think it's a huge deal to tell iOS to go away.


onsdag 22. februar 2012 kl. 01:43:56 UTC+1 skrev KJ følgende:
Hello there,
This is my first post to the group.

I'm having an issue with Phonegap 1.4.1 and using Sencha Touch 2.

When I trigger the getPicture method through a simple button tap my
app throws a memory warning before crashing out completely. It only
seems to crash when I take the image or click cancel on the default
camera screen on iOS5.

I'm calling it using the following code placed inside my button
listener:, this.onFail,
{ quality: 50,
                    destinationType: Camera.DestinationType.FILE_URI });

My app runs fine until I try and take a photo with the camera and then
I get the following dump to my xcode IDE log:

2012-02-22 00:42:02.135 myapp[26137:707] [INFO] on capture image
[Switching to process 7171 thread 0x1c03]
2012-02-22 00:42:05.684 myapp[26137:707] Received memory warning.
2012-02-22 00:42:13.974 myapp[26137:707] -[__NSCFString
pickerController]: unrecognized selector sent to instance 0x12b8c0
2012-02-22 00:42:13.979 myapp[26137:707] *** Terminating app due to
uncaught exception 'NSInvalidArgumentException', reason: '-
[__NSCFString pickerController]: unrecognized selector sent to
instance 0x12b8c0'
*** First throw call stack:
(0x3806b8bf 0x31b511e5 0x3806eacb 0x3806d945 0x37fc8680 0x14253
0x3568af5f 0x363bba79 0x363cce2f 0x363fa167 0x363fa027 0x363a7bf1
0x363d19af 0x37fc5435 0x3543e9eb 0x3543e9a7 0x3543e985 0x3543e6f5
0x3543f02d 0x3543d50f 0x3543cf01 0x354234ed 0x35422d2d 0x37b40df3
0x3803f553 0x3803f4f5 0x3803e343 0x37fc14dd 0x37fc13a5 0x37b3ffcd
0x35451743 0x2f6f 0x2ef4)
terminate called throwing an exception(gdb)

Does anyone have an ideas?

In my build settings my compiler is set to LLVM GCC 4.2