Dmitry
Dmitry

Reputation: 1041

iPhone permanent data store

How to store information in iPhone so that it cannot be removed when application removed. For example to indicate if user already used all trial features. I tried to use [NSUserDefaults standardUserDefaults] - but it refreshed each time app deleted.

Upvotes: 1

Views: 498

Answers (4)

jimothy
jimothy

Reputation: 510

Your best bet here is probably to store data to a server, associating the device UDID with whatever information you want to store. To get the UDID, do this:

NSString *udid = [[UIDevice currentDevice] uniqueIdentifier];

If you don't want to setup a server yourself, you can use this handy service I've been trying out called Parse: http://www.parse.com/ You'll be able to use their native SDKs to store data to their cloud service, and then retrieve it. You should be able to simply store the udid with one of their objects, and then retrieve it again with a query.

Upvotes: 2

zoul
zoul

Reputation: 104105

I think it’s possible to store such data in the keychain, see this forum. I also think it’s evil to do such a thing, as you are fighting the user, but it’s your choice.

Upvotes: 2

Michael Petrotta
Michael Petrotta

Reputation: 60962

Some applications handle this by retrieving the device's unique identifier (UDID) and storing it one their servers. If the server sees the same UDID twice from the application's validation step, deny validation.

Upvotes: 3

Alex Wayne
Alex Wayne

Reputation: 187242

Apple doesn't allow you to do this. If Apps could leave files after they are uninstalled then you could have your disk fill up with no way to actually get rid of the stuff.

Upvotes: 4

Related Questions