Skip to main content
Known Participant
January 18, 2012
Question

Where to save flag for in app purchase?

  • January 18, 2012
  • 6 replies
  • 1628 views

I have read that the new IOS Data Storage Guidelines can result in an app being rejected if the data is not stored correctly in the right location.

My app includes an in app purchase and I was going to save a flag to record if the in app purchase has been purchased using a Shared Object.

I believe this is no longer allowed and I need to use the File.applicationStorageDirectory API

I therefore could do with advice on where to save the Flag.

Thanks in advance

This topic has been closed for replies.

6 replies

January 19, 2012

Not sure if this is needed. First problem I see is that I can be user "A" while purchasing an item and later when actually playing i can be "B" (A and B being iTunes user account).

I think the preferred way would be to call restore transactions and let iTunes tell what all goods current user has purchased. You may want to cache that info in Caches folder but you should not be dependent on it.

P StevenAuthor
Known Participant
January 19, 2012

Thank you Saumitra for the reply. I was under the impression I needed to save a flag so that the app would work when the user was not online for example if they were on a plane. Hence in such a situation they would be unable to contact iTunes. I also thought I had read that every time restore transactions is called it displays the login box which I really would prefer not to happen every time someone launches the app.

If I wrote a flag, could I not associate it with a particular user.

So if I did want to write a flag, is the caches folder the place to write it to? And if so, why could I not be dependent on it here?

Btw, thank you so much for writing the in app purchase native extension - works really well!

January 19, 2012

Yes, I think caches would be the best match for storing such info because:

1. this info can be regenerated.

2. this flag is not essential for the functioning of app given point 1 holds. hence it can be purged by iOS if it finds the system in low mem conditions.

for your other concerns about the login dialog etc. if you want that flags are essential and you want to be dependent on it IMO "Private Documents" is where it should be. because as per Apple Docs

Offline Data

This is data that can be downloaded or otherwise recreated, but that the user expects to be reliably available when offline. Offline data should be put in the <Application_Home>/Documents directory or in the <Application_Home>/Library/Private  Documents directory (see QA1699 for details) and marked with the "do not backup" attribute. Data stored in either location will persist in low-storage situations and the "do not backup" attribute will prevent iTunes or iCloud backing up the data. Offline data files should be removed as soon as they are no longer needed to avoid using unnecessary storage space on the user's device.

this is what you want to do rite? "Private Documents" is not accessible to iPhone user and user cant modify contents of this through iTunes.

I hope, I am still making sense