views:

4970

answers:

4

When my app is run in the iPhone simulator, the delegate method

- (void)applicationWillTerminate:(UIApplication *)application

is only called the first time I hit the iPhone simulator's home button.

After the home button is pressed and the app is launched again, hitting the home button does not call the delegate method.

What is going on here? Am I misunderstanding something fundamental?

A: 

I suspect this is one of the many areas where the iPhone simulator does not match a real device.

Darron
+14  A: 

I suspect that it is being called, but that you are getting confused because after you hit the Home button in the Simulator, you've ended the current session in Xcode. You probably have an NSLog in your applicationWillTerminate: method, yes? Once you hit the Home button, NSLogs no longer show up in Xcode's run console. If you open /Applications/Console.app I expect they'll show up there.

Kevin Ballard
Yes you are correct. Calls to NSLog() do not appear after the first time returned to the Home screen. However all other function calls called from the delegate continue to operate as per usual. Thanks!
firstresponder
Xcode no longer pays attention to the logging output from the iPhone Simulator after you terminate the program and return to Springboard. Everything still functions exactly the same except output won't go to Xcode's run log.
Kevin Ballard
I can we differentiate the (application termination due to some phone call and resuming it from previous state) and (application launch) ?
srikanth rongali
A: 

My question to Kevin is how did the log appear on the Xcode console the first time?

A: 

@Kevin

/Applications/Console.app ??? What is this?

OOP_Master