How to save state of iphone application while calling

Discussion in 'iOS Programming' started by sandhya.rai, Sep 29, 2009.

  1. sandhya.rai macrumors newbie

    Joined:
    Jan 12, 2009
    #1
    Hi All ,


    I want to know how to save the state of application while
    calling from application .How the state of an application
    can be saved while calling from iphone application.


    Thanks in advance
    sandhya
     
  2. drivefast macrumors regular

    Joined:
    Mar 13, 2008
    #2
    there is no one single instruction and no universal recipe for that. it greatly depends on the state of each application. typically i make sure that each object i create is serializable, and when the time comes i use the NSKeyedArchiver on them. restoring is a bitch - you have to rebuild the views and view controllers structure, just like the user navigated to the point it was interrupted. it's a good practice to do that when you need to have the app start from where it was shut down last time, for whatever reason, including initiating a call from the app.

    this being said, i think when you receive a phone call you dont have to go thru all that pain. somebody correct me if i'm wrong, but i remember a phone call only suspends the execution of your application, leaving it in memory, and resumes the app when the call is done. this would probably screw up timers if you have any, but generally you should be safe.
     

Share This Page