I am trying to allow the user to try a trial of something in my app but only once. How do I store this information even after the user deletes the app so that the user cannot reinstall the app to try the trial again?
-
Why would you want that? Sounds to me like you're making it difficult in the first place by only allowing a single execution. Would deter me from using it if I had to re-install each time. And if I knew your app stored data perm on my device I would "never" install it in the first place – griegs Apr 09 '13 at 05:02
-
Fair enough, I guess I'll try out not storing anything. – aeubanks Apr 09 '13 at 05:14
-
possible duplicate of [Is there a way to persist application data between application installs and uninstalls in iOS](http://stackoverflow.com/questions/10138115/is-there-a-way-to-persist-application-data-between-application-installs-and-unin) --- you can use the Keychain. – Martin R Apr 09 '13 at 05:18
3 Answers
You can use the Keychain, because the Keychain items are not deleted even if the app is removed from the device. (It may be removed with a "secure wipe", as stated here: https://stackoverflow.com/a/3885110/1187415, I am not sure about that.)
Unfortunately the combination of the way the App Store works and the way sandboxing works prevents that kind of thing. You could, however, make it more difficult for the user to do the thing multiple times. Just put a BOOL in the NSUserDefaults saying the user has done the thing, and refuse to do it again. Of course the user can delete the app (thus deleting the NSUserDefaults), reinstall it, and do the thing again — once. But that would be a lot of work, so there's your deterrent.

- 515,959
- 87
- 875
- 1,141
-
I think I'll do that. If there's no way to permanently store data then I kind of have to. Thanks! – aeubanks Apr 09 '13 at 05:14
-
@aeubanks Or, if you have a server send the device ID (mac ID to your server), and keep a note on your server, that this device has already used your trial once, and should not be given a chance to do that again. – Nikita P Apr 09 '13 at 05:18
-
@NikitaP Yes, I thought of that too. I didn't mention it because it wasn't quite what he asked. And would that sort of thing get past the App Store guardians? – matt Apr 09 '13 at 05:19
-
What about the Keychain, as suggested in http://stackoverflow.com/questions/10138115/is-there-a-way-to-persist-application-data-between-application-installs-and-unin ? – Martin R Apr 09 '13 at 05:19
-
You can't use the device ID or MAC ID in apps submitted anymore. Martin R is right, the Keychain can be used to persist data across installations and deletions. – Seamus Campbell Apr 09 '13 at 05:20
-
Ooooh, that's much better than my answer. @MartinR you should make that an actual answer. You deserve the checkmark. – matt Apr 09 '13 at 05:21
-
As Apple has mentioned, it is deprecating device ID(UDID), not the Mac ID, so APPStore should not have a problem with that. However, Martin's answer is more applicable. :) – Nikita P Apr 09 '13 at 05:31
This will be happen if your using Authentication for your application. The solution is like this, Put one Authentication Page as a starting point for your app. once user login send the information to your server. Next time onwards even user deleting your app and re instal also there is no possibility to use it, in your web server response will be changed.
app-->login-->server-->response-->opening app--> storing the response in local persistence this will happen every time user re instal the app. Let us assume your trail module will open by clicking on a button, Once click on the button put check and get info from your local persistence and intimate to user with your error message.
Hope this ll help you to get idea on the server-client model.Good luck.
Note: Once user deletes your app all the data related to your app will be deleted from the device.

- 3,245
- 4
- 31
- 59