Reputation: 15993
I created an iPhone app with XCode and Phonegap.
Launching the app works perfectly fine but when I press the home button of the iPhone (which puts the app into the background) and then open the app again (to bring it to foreground), it crashes.
This is what the logs say:
2012-10-31 14:37:21.359 [810:907] -[AppDelegate myFunc]: unrecognized selector sent to instance 0x1e064220
2012-10-31 14:37:21.361 [810:907] --- Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AppDelegate myFunc]: unrecognized selector sent to instance 0x1e064220'
--- First throw call stack:
(0x361b62a3 0x344c697f 0x361b9e07 0x361b8531 0x3610ff68 0x36107037 0x33bc9d91 0x37630213 0x3762fdff 0x37487d61 0x374876d5 0x37487123 0x3663a5a3 0x3618b683 0x3618aee9 0x36189cb7 0x360fcebd 0x360fcd49 0x366392eb 0x374db301 0xe7c89 0xe7c20)
libc++abi.dylib: terminate called throwing an exception
The image attached shows the line of code where it stops.
What's going on?
Upvotes: 0
Views: 193
Reputation: 4371
I might be wrong, did you add some logic in
- (void)applicationWillEnterForeground:(UIApplication *)application
- (void)applicationDidBecomeActive:(UIApplication *)application
And there is something you have released? And also did you check with this?-[AppDelegate myFunc]
Upvotes: 1
Reputation: 7689
It appears you're invoking a method called myFunc that doesn't exist on your AppDelegate.
This will cause the application to terminate. Check that function exists or remove the invokation.
When you bring an app from the background to the foreground, different methods are invoked on the delegate, so your call to MyFunc might exist there.
Check
applicationDidBecomeActive
and
applicationWillEnterForeground
The details of this can be found here:
Upvotes: 2