Text message notification and saving data

Discussion in 'iPhone/iPad Programming' started by Labeno, Apr 21, 2009.

  1. macrumors member

    Joined:
    Jul 21, 2008
    #1
    If a text comes in and the user switches over to the SMS app, then my app does not store any data (i.e. I don't think a call to applicationWillTerminate is made, which is the function that stores the data). I've read the iPhone document that states applicationWillTerminate is called any time the app exits, but this does not seem to be the case.

    Anyone else out there experiencing the same issue?
     
  2. macrumors demi-god

    fishkorp

    Joined:
    Apr 10, 2006
    Location:
    Ellicott City, MD
    #2
    I think you need to use applicationWillResignActive instead of applicationWillTerminate when being interrupted by SMS/phone call.
     
  3. thread starter macrumors member

    Joined:
    Jul 21, 2008
    #3
    The documentation advises to use applicationWillResignActive to do things like pause if it's a game to give the user a chance to respond to the alert. Then if the user does respond, then applicationWillTerminate will still be called.

    Apple may have not written the document correctly, and I have not tried this, so I will give it a go and test it. Thanks for the advice.
     
  4. Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    You're sure about this? You've put an NSLog or a breakpoint into that method and are certain it is not being called?
     
  5. thread starter macrumors member

    Joined:
    Jul 21, 2008
    #5
    I thought I checked on this, but I will verify shortly.
     
  6. macrumors demi-god

    fishkorp

    Joined:
    Apr 10, 2006
    Location:
    Ellicott City, MD
    #6
    Yep, you're right. I was thinking about that situation. I apologize.
     

Share This Page