I’ve got an iPhone app that loads user information as an XML file and stores it as as NSUserDefaults. The defaults are persisting between launches, however, and I’d like to force a reload each launch. Presently the initial download is in the applicationDidFinishLaunching method of my app delegate. Is there a way I can detect whether an app has been ‘woken’ (i.e. opened again but perhaps not launched because of iOS 4 persistence) or can I delete these defaults when an app ‘sleeps’?
Share
In short, I would try doing that setup / tear down work in applicationDidEnterForeground: or didBecomeActive: and their respective mirrors.
If you need a little more guidance, check out the official docs here:
I would recommend following the standard procedures laid out in the following docs:
http://developer.apple.com/LIBRARY/IOS/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/StandardBehaviors/StandardBehaviors.html#//apple_ref/doc/uid/TP40007072-CH4-SW7
With a snippet being: