How To Add “Fast App Switching” To Your iPhone App in iOS 4
iPhones 4 and iOS 4 introduce Apple’s take on multitasking applications. We can now “freeze” or “background” our apps so that when the user quickly switches between apps, our’s will return in the same state we left it.
I had a little trouble getting this done, but in the end it’s REALLY easy.
4.0 introduces a new project property in the info.plist called UIApplicationExitsOnSuspend. The default value for this boolean property is false. All you may need to do is recompile your application and check it out on an iOS 4 device.

If you find it’s not working, confirm the SDK settings both at the project level and at the target level. Your base SDK should be 4.0, and your target SDK should be whatever your lowest target device is. Of course, lower versions of the OS that don’t support multitasking will simply ignore this setting.
Also make sure your SDK settings are consistent between the project and the target settings.


To take multitasking even further, there are additional methods available where we should put any code we want to execute when the app goes into the background or returns to an active state, such as:
- store/restore state
- start/stop background processes
Check out:
application:didFinishLaunchingWithOptions
applicationDidBecomeActive
applicationWillResignActive
applicationDidEnterBackground
applicationWillEnterForeground
applicationWillTerminate
iPhone • Permalink


