I have an app that captures the notification of applicationWillResignActive to write out a file. It works great on various devices (including 4.x iPhones), but never with my iPod Touch (2nd gen) running iOS 4.2.1. I have breakpoints set at the beginning of the functions and they are never triggered either so it isn't code specific. Seems like a strange thing to be device specific, but perhaps I need to find an alternative. Is this something that is a known problem?
It may be becouse of lack of multi-tasking support on 2gen devices such as iPod 2gen and iphone 3G (not 3GS). This is the latest OS your ipod will see. Since the old devices does not have this support, this delegate will only be fired upon incoming phone call or SMS message received. When pressing the home button on this devices, the applicationWillTerminate will be fired instead. Use [[UIDevice currentDevice] multitaskingSupported]
to detect if the model support multitask and use it to pass code to applicationWillTerminate:
- (void)applicationWillTerminate:(UIApplication *)application
{
if(![[UIDevice currentDevice] multitaskingSupported])
{
//Your code here for non-multitasking devices
}
//Code for booth plataforms
}
Hope it helps.