iOS Question Which is the best directory to save subscription info?

jai

Active Member
Licensed User
Longtime User
I am finishing up a new app which will have non-renewing subscription as in-app purchase and need some advise on where to save a file that contains the subscription info.

This file will be created when the user purchases a limited time subscription to app’s premium features and will contain the expiration date among other items. The app will look here at times to check if the user has a subscription and is current on it. This file will be deleted after the subscription expires.

Is File.DirLibrary the best place to create such a file? If not, where?

Two more caveats:

1. The file should be automatically backed up by iTunes so it gets restored if the user deletes and reinstalls the app or reinstalls it on another iOS device with the same ID, and​

2. The file should not be visible in iTunes as a shared file thus preventing the user from copying and passing it to others.​

Appreciate any guidance.
 

Pendrush

Well-Known Member
Licensed User
Longtime User
I'm using File.DirDocuments in my approved app.
No matter is the file backup-ed or not, user must be able to restore purchase from your app.
 
Upvote 0

jai

Active Member
Licensed User
Longtime User
Thanks for your response Pendrush. I am not sure though if it is related to non-renewing subscriptions and have quick follow up questions-

1. Does your app contain non-renewing subscription(s)?
2. Are you saving the subscription info in File.DirDocuments even when such file can easily be copied and shared with others via iTunes?
3. My understanding is that unlike a non-consumable purchase the in-app mechanism can only be used to purchase a non-renewing subscription and not query or restore an existing one. One needs to either use a server or store subscription info in the app to accomplish Restore. I am trying to figure out what subdirectory will be best to store this info in and am tending towards File.DirLibrary which is automatically backed up by iTunes but is not visible in iTunes as a shareable file when you connect the device to a PC. How are you accomplishing it?
Please share your suggestions if you are familiar with such a situation involving non-renewing subscriptions.
 
Last edited:
Upvote 0

tufanv

Expert
Licensed User
Longtime User
Erel,

Does this directory is safe enough to save this data with a sql file ? Because if it is not , subscriptions can be altered by users as they like.. ?
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
Erel,
non-renewing subscriptions are like consumables. When user subscribed for 1 week for example and the payment is successful, the store does not hold the data. When i use restoretransacitons , there are no transacitons because it is consumed like a consumable. So if user uninstalls and reinstalls the app there is no way to insert start and end date again to a local db. What can you suggest for this ?
No. The user will need to use the restore transactions in this case.
 
Last edited:
Upvote 0

tufanv

Expert
Licensed User
Longtime User
You can store permanent information in the keychain (iPhone library).
Yes. This will fix the problem.Does puting to same key a different value means updating it ? ( for example i will put start,"05-05-2011" . Then with next subscirption i have to update it , or do i have to delete and put again)

Can you suggest anything for syncing on multiple devices without a server end solution ? ( the non -renewing subscriptions )
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Does puting to same key a different value means updating it ?
Yes.

Can you suggest anything for syncing on multiple devices without a server end solution ? ( the non -renewing subscriptions )
Not sure. I haven't experimented with this myself.
 
Upvote 0
Top