Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Labeno

macrumors 6502
Original poster
Jul 21, 2008
351
1,089
If a text comes in and the user switches over to the SMS app, then my app does not store any data (i.e. I don't think a call to applicationWillTerminate is made, which is the function that stores the data). I've read the iPhone document that states applicationWillTerminate is called any time the app exits, but this does not seem to be the case.

Anyone else out there experiencing the same issue?
 

Labeno

macrumors 6502
Original poster
Jul 21, 2008
351
1,089
I think you need to use applicationWillResignActive instead of applicationWillTerminate when being interrupted by SMS/phone call.

The documentation advises to use applicationWillResignActive to do things like pause if it's a game to give the user a chance to respond to the alert. Then if the user does respond, then applicationWillTerminate will still be called.

Apple may have not written the document correctly, and I have not tried this, so I will give it a go and test it. Thanks for the advice.
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
I've read the iPhone document that states applicationWillTerminate is called any time the app exits, but this does not seem to be the case.
You're sure about this? You've put an NSLog or a breakpoint into that method and are certain it is not being called?
 

Labeno

macrumors 6502
Original poster
Jul 21, 2008
351
1,089
You're sure about this? You've put an NSLog or a breakpoint into that method and are certain it is not being called?

I thought I checked on this, but I will verify shortly.
 

fishkorp

macrumors 68030
Apr 10, 2006
2,536
650
Ellicott City, MD
The documentation advises to use applicationWillResignActive to do things like pause if it's a game to give the user a chance to respond to the alert. Then if the user does respond, then applicationWillTerminate will still be called.

Apple may have not written the document correctly, and I have not tried this, so I will give it a go and test it. Thanks for the advice.

Yep, you're right. I was thinking about that situation. I apologize.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.