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

Discussion in 'iOS Questions' started by jai, May 15, 2015.

  1. jai

    jai Member Licensed 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.
     
  2. Pendrush

    Pendrush Active Member Licensed 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.
     
  3. jai

    jai Member Licensed 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: May 16, 2015
  4. Erel

    Erel Administrator Staff Member Licensed User

  5. jai

    jai Member Licensed User

    Thanks Erel!
     
  6. tufanv

    tufanv Expert Licensed 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.. ?
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    The user cannot access File.DirLibrary files.
     
    tufanv likes this.
  8. tufanv

    tufanv Expert Licensed User

    perfect ty
     
  9. tufanv

    tufanv Expert Licensed User

    So we will copy the file if it is not exists in dirlibrary and than if user deletes and reisntall the app the old file will be preserved right ?
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    No. The user will need to use the restore transactions in this case.
     
  11. tufanv

    tufanv Expert Licensed 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 ?
     
    Last edited: Nov 7, 2015
    valentino s likes this.
  12. Erel

    Erel Administrator Staff Member Licensed User

    You can store permanent information in the keychain (iPhone library).
     
  13. tufanv

    tufanv Expert Licensed User

    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 )
     
  14. Erel

    Erel Administrator Staff Member Licensed User

    Yes.

    Not sure. I haven't experimented with this myself.
     
    tufanv likes this.
  15. tufanv

    tufanv Expert Licensed User

    Can users change my apps keychain entries easily ? i mean is it secure to store subscription info there like the file.dirlibrary
     
    valentino s likes this.
  16. Erel

    Erel Administrator Staff Member Licensed User

    No. Only your app has access to this keychain.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice