Saving State when App terminates question

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

  1. sldice macrumors newbie

    Oct 24, 2010
    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


    Jul 24, 2002
    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

    Oct 24, 2010
    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

    Aug 26, 2010

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

Share This Page