Saving State when App terminates question

Discussion in 'iOS Programming' started by sldice, Oct 25, 2010.

  1. sldice macrumors newbie

    Joined:
    Oct 24, 2010
    #1
    I know this is probably basic, but I am brand new to programming and I am struggling to find the answer. Here is what I have:

    A music trivia app with a score, timer, and 4 buttons as answers. Each question is on it's own separate viewController/xib file. If you get the question correct you choose next and it goes to the next question(viewController). Sorry if my terms are incorrect.

    All I want to do is when the app terminates, when you relaunch, it goes to my Start screen and they can choose to start again, or continue where the app terminated. Can someone please help me with this? I need to return to the last question when terminates, and save the score. Thank you in advance.
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    There is no generic answer here: you need to work out what state you need to save to restore the objects in your application back to where you are. Once you do that my normal method is to store the details to NSUserDefaults. You may find using key-value coding and a NSCoder helps.
     
  3. sldice thread starter macrumors newbie

    Joined:
    Oct 24, 2010
    #3
    Thank you for your response. Are you aware of any good tutorials or websites that help explain how to make this work or understand better? I just can't seem to grasp how to do it.
     
  4. Sykte macrumors regular

    Joined:
    Aug 26, 2010
    #4


    You could start with the Mac Guides at the top of the forums.
     

Share This Page