4

I have a paid app that has been on the App Store for a year.

I am wanting make two changes to this app; 1) make the app free, and, 2) add advertising. But, I’m wanting to ensure that current users who purchased the app never see advertising.

Two solutions I have considered:

I could either completely delete the current app from iTunesConnect and the App Store then submit a brand new replacement app with a new Bundle ID.

Alternatively, in the current app, I could make a request to the App Store and check when the user first purchased the app as a way to determine whether or not to display advertising or not.

On the developer website I’ve read ‘Validating Receipts With the App Store’ and understand StoreKit and appStoreReceiptURL are involved, but am no clearer as to how to implement and achieve this in Swift 2.


Question:

Anyone experienced with such matters, in Swift 2, how do I make a successful request to the App Store and check the date when the user purchased the app?

user4806509
  • 2,925
  • 5
  • 37
  • 72
  • 1
    Check the application receipt; the process is described in the in app purchase programming guide; there is still a receipt, even if you aren't using in-app purchase. – Paulw11 Aug 05 '17 at 11:55
  • 3
    I would use [SwiftyReceiptValidator][1] to get the receipt from the App Store. You get a JSON response with all kinds of information in it. Also the purchase date. [1]: https://github.com/crashoverride777/SwiftyReceiptValidator –  Aug 05 '17 at 16:37

2 Answers2

0

Seems that the only approximate solution is to check the creation date of the app's document directory which is created when the app was installed in the device.

-1

I don't think you can get the purchase date in your code. As a workaround you could check for the app version:

    if let version = NSBundle.mainBundle().infoDictionary?["CFBundleShortVersionString"] as? String {
        let versionNumber = Float(version)

        if versionNumber < 1.xx
        { 
           // .. Do something
        }
    }
Nikita Gaidukov
  • 771
  • 4
  • 14
  • Thanks, but not certain that would work. If the paid users update to the most recent app, then the most recent version will be returned, it won't be possible to determine paid customers from new free customers. – user4806509 Aug 05 '17 at 11:29