Search code examples
iosstate-restoration

Delete data saved during state preservation and restoration


My app has a bunch of state preserved and restored to at various times and I'd like to give to the user the option of clearing everything.

Is it possible to programmatically clear all of preserved data?


Solution

  • To clear preserved data, you need to return NO from app delegate method

    application:shouldSaveApplicationState:
    

    But, Apple has provided this concept, to relaunch the application to previous state even after app moves from background to either terminated or suspended state. This is nothing to do with application user. As for my understanding, we should not provide the option to user to clear state preserve data.

    Thanks, Purna