tags:

views:

110

answers:

2

When does data get restored for an app? What if I save data in the app's document directory. Then they sync with iTunes. Now iTunes has a backup. Will that data be populated to another device when they sync that new device to their iTunes or will they just get a clean install of my app? I'm trying to figure out how to keep track of a subscription in app purchase and was wondering if I could keep record in NSUserDefaults or some other local store.

+1  A: 

Backups are per-device. So a backup of your iPod will not be restored to your iPhone. In other words, there is no sync.

St3fan
A: 

If the user backs up to iTunes, and then restores their backup to another device (maybe they lost their original iPhone), the contents of the app Documents directory will be put on the new device. Anything in the tmp folder won't be backed up or restored like this, but the Documents folder will.

However, that's not the best way to store the in-app purchase information. You should be storing that on your own server and keeping a count of the number of times the purchased content has been used. Inform the user that they can use it a certain number of times (say three) and after that they will have to buy it again. I'm not exactly sure of any details beyond that (like how to verify their identity) but it should get you started.

nevan
Yeah, I've seen that that is the recommended way however what I don't see is how to identify the user. I see how to identify the device, but the whole point is to allow the user to swap devices and not loose the subscription. This seems to be a pretty big omission on Apple's part from all the comments/questions on their dev forums.
jamone