views:

68

answers:

1

I found this method in a delegate file and inserted some code. The code never gets executed, even when the home button is pressed. When or how does this function get called?

+1  A: 

You should use applicationDidEnterBackground method if your app and OS support multitasking.

From applicationWillTerminate docs:

For applications that support background execution, this method is generally not called when the user quits the application because the application simply moves to the background in that case. However, this method may be called in situations where the application is running in the background (not suspended) and the system needs to terminate it for some reason.

Vladimir
I thought the iPod touch doesn't multitask. Only one program runs at a time.
awakeFromNib
iPod touch 3G does - see http://en.wikipedia.org/wiki/List_of_iOS_devices#Features for what devices support multitasking (last row in the table)
Vladimir