angerman
angerman

Reputation: 4149

Can I programmatically wipe the application data in applicationDidFinishLaunching:withOptions:?

For testing purposes, I'd like to be able to just reset the application to a clean state. (Similar to what deleting the app from the Simulator / iPhone does).

Assume we have a WIPE_DATA define, if that is set, the app should start as if it has been just installed. Obviously if you know the app, you know where it stores data in NSUserDefaults etc. I was wondering if there was a more generic approach that requires no insight into the specific app and thus would be applicable to any app.

Upvotes: 0

Views: 1092

Answers (1)

Maksim
Maksim

Reputation: 2052

In your app you have two kinds of data - NSUserDefaults settings and files in Documents directory. If you want to wipe all the data to make your application to initial state and settings, you should create e.g. an app delegate method which set initial NSUserDefaults settings and clean application generated files in Documents directory.

As far as I know there is no standart system way to do that.

Upvotes: 1

Related Questions