Reputation: 443
Is it possible to clear the data of an app on iPhone/iPad without deleting the app? In Settings, general->usage->app where I can delete the app.
Thanks in advance.
Upvotes: 1
Views: 1601
Reputation: 3475
So these are the steps for clearing data
1) clear core Data model Delete/Reset all entries in Core Data?
2) Set all NSUserDefaults to their default value
3) Delete all files in document directory
let fileManager = NSFileManager.defaultManager()
let enumerator = fileManager.enumeratorAtURL(cacheURL, includingPropertiesForKeys: nil, options: nil, errorHandler: nil)
while let file = enumerator?.nextObject() as? String {
fileManager.removeItemAtURL(cacheURL.URLByAppendingPathComponent(file), error: nil)
}
Upvotes: 1