iOS App Persistent Settings After App Deleted

心已入冬 提交于 2019-12-04 14:51:37

Just my 2c as @Almo covers most of this already and should get the credits :-)

NSUbiquitousKeyValueStore has the advantage of being by-user, e.g. several devices would share the same free tokens. OTOH that might not be something you want in your app...

Leaving data after uninstallation goes against the sandboxing of applications. There are ways to do it, like you can add images/photos/contacts/..., but unlikely to be "Apple approved" and more than likely easy to hack around.

So I also suggest you to use a web service. A simple way would be to validate with the service (e.g. using the device's MAC address since the device unique identifier is going away) when no application data is found (install and re-install) if it's a know device (no token) or not (get tokens).

If the paid tokens are re-usable (could be re-played by re-installing a backup that includes them as data) then you might want to track them with the web service. Non-reusable tokens won't suffer from this (and are likely easier to deal with).

You can set token to the Keychain. If the user uninstall app and install it again you can restore token from the Keychain.

sskeychain

Even if you try to make the setting persistent, I don't think it would be that hard for them to find that and delete it as well during a reinstall. If you want to prevent just casual cheating, maybe that's fine. But if this is your revenue stream, I'd recommend using a webservice.

Edited to add: I don't have any experience with iCloud. That might make sense, too.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!