问题
I am developing an app, which offers a testing period for a feature. After a few days after starting the app for the first time, the user is not able to use this feature any more unless he buys it with an in app purchase.
I store the first time the app was started in the user preferences. It would be nice to restore this information, after user de-installs and reinstalls the app.
-> Is there anyway to restore internal app data after deleting the app from an iPhone?
回答1:
You need to use the keychain for this. Keychain data will survive an app deletion and reinstall. This way your timestamp won't be lost and will prevent users from "cheating" by reinstalling the app.
Grab the KeychainItemWrapper class from the GenericKeychain sample app. This makes working with the keychain a lot easier.
回答2:
if you are using the webservices then you can retrive it using web services.else you can save it into the keychain access.
回答3:
UserDefaults get deleted when you remove an app from the phone. Maybe you can use the Parse Data. I always use a Parse
https://www.parse.com/products/data
来源:https://stackoverflow.com/questions/16386423/ios-restore-data-after-reinstalling-app