1

I've been having a look at the "State Preservation and Restoration" section in iOS App Programming Guide, and the process described there seems to be available only from iOS 6. Since I need to make my app compatible from iOS 5, I don´t find a, let's say, equivalent way to handle this.

To provide a certain scenario, I have an UINavigationController where I push a sequence of view controllers where I request user input. It is like a step-by-step form, and data provided is not finally saved until the last step is completed. I'd want to temporarily save the inputs as the user provides them, just in case the app terminates or goes to background, to show them again when the user returns to the app, in order to prevent him from having to enter again the data that he already provided. This may be a common scenario in an iOS app, I guess.

I was thinking about saving temp data to files, but I don't know if this is the unique/best way in iOS 5. Any help or any example/tutorial/document dealing with this issue?

Thanks!

AppsDev
  • 12,319
  • 23
  • 93
  • 186
  • 1
    As you say, this feature is only available in iOS 6 and above. That means for iOS 5 and below you need to rely on a custom solution. I suggest using `NSUserDefaults`, or Core Data if the dataset is large. – borrrden Jul 11 '13 at 03:43

1 Answers1

0

Prior to iOS 6, you had to save/restore state yourself by overriding functions like applicationDidEnterBackground and applicationWillTerminate in your application delegate.

You'll learn everything you need by searching on stackoverflow or google for those functions names, but in short you had to write a custom solution (typically saving all the info you need to a restore again to a file).

Pieter
  • 17,435
  • 8
  • 50
  • 89