tags:

views:

469

answers:

1

Hello

If the user received a call during application running, how to automatically open the application after call ended. And how to restore the last session, so that the user would not start from the beginning?

Thanks

+3  A: 

You need to implement the following methods from the UIApplicationDelegate protocol:

  • applicationWillResignActive is called when the phone receives an incoming call
  • applicationWillTerminate is called when the user answers the call
  • applicationDidBecomeActive is called if the user choose not to answer the call

applicationWillTerminate will give a few seconds to save your apps current state. The easiest way to save state is through the NSUserDefaults class. When the app starts again you read your state from NSUserDefaults and restore the app to its previous state.

Jens Utbult
just to clarify: if user answer the call, he will have to lunch the application again? right?
Dmitry
If the user answers a call the application will quit and then launch automatically once the call is finished.
Jens Utbult