iPhone application v/s incoming call?

Discussion in 'Mac Programming' started by sujithkrishnan, Jun 3, 2008.

  1. sujithkrishnan macrumors 6502

    Joined:
    May 9, 2008
    Location:
    Bangalore
    #1
    Hi all.

    Being a newbie, i am making use of iPhone simulator to test my apps.

    I want to know what will be the state of my app, if an incoming call will occur?
    whether the state get saved (by default) or can we write any code in our app to take care of the state of our app??

    Please help as soon as possible..
    Thanks.
     
  2. wrldwzrd89 macrumors G5

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #2
    My understanding is that you need to take care of saving the state. For applications that take advantage of Objective-C's built-in serialization mechanism, this generally means you don't have to do any work at all, besides making sure your application isn't in a critical region (a place where interrupting would cause problems). For example, in a game, you'd want to put the game into a paused state if you detect an incoming call.
     
  3. Buschmaster macrumors 65816

    Buschmaster

    Joined:
    Feb 12, 2006
    Location:
    Minnesota
    #3
    I believe what you are looking for is
    Code:
    - (void)applicationWillTerminate:(UIApplication *)application;
    What you will want to do is find a way to save a state. What I'm using is a property list to manage much of the data for my app. So I have another property list that acts as a cache and stores the last level of navigation it was on and a couple other things it needs. Right now I have it so that it should come back to right where you were, but I'm thinking of possibly making it so that if you exit on purpose it will restart the app.

    Additionally, I'm not on forums quite often enough to keep up with all of the chat language. What's v/s?
     
  4. wrldwzrd89 macrumors G5

    wrldwzrd89

    Joined:
    Jun 6, 2003
    Location:
    Solon, OH
    #4
    I took it as meaning "versus".
     
  5. megfilmworks macrumors 68020

    megfilmworks

    Joined:
    Jul 1, 2007
    Location:
    Sherman Oaks
    #5
    versus?
     
  6. Buschmaster macrumors 65816

    Buschmaster

    Joined:
    Feb 12, 2006
    Location:
    Minnesota
  7. Sbrocket macrumors 65816

    Sbrocket

    Joined:
    Jun 3, 2007
    Location:
    /dev/null
    #7
    So here's the corollary to this - is there some way to tell if the application will be relaunched after whatever closed it is finished (I believe calls ending will relaunch the open app after they're finished, but I could be wrong, at which point this would all be moot) or if it wont?

    In other words, the difference between a call closing the app and the user closing the app manually. Seems like there would be many cases where you'd want to save the state in one, but not the other (a calculator for example).
     
  8. sujithkrishnan thread starter macrumors 6502

    Joined:
    May 9, 2008
    Location:
    Bangalore
    #8

    Hi,

    I successfully made use of archiving of objects, but i ddnt get how to save the entire state of application !!
    Also the above method get called if application terminate by user and by incoming call..
    But i want to save state only when incoming call terminates the app.

    Kindly give me a clear idea of how to save the state of app, and detect teh incoming call in the above method.

    Is there any way to simulate incoming call in Iphone simulator?

    Please help...:(
     

Share This Page