Where to check the expired subscription using non-renewal subscriptions?


We are using non-renewing subscriptions in our iOS application and are confused to when and where expired subscriptions are removed. For instance we show two subscriptions (7 days and 30 days). The user then purchases one of the subscriptions and we save that in NSUserDefaults along with storing in database on the server (creation date, subscription type, expiration date). Now the confusion we have is when the user is past their 7 days (or 30 days), how do we expire the subscription?

We were thinking of doing it in didFinishLaunchingWithOptions however what happens if the user stays logged in and never terminates their application,

I would do it in applicationDidBecomeActive. This is called every time they launch the app even if it was never terminated. I would guess you would be pretty safe with this. If someone is willing to keep your application open constantly to prevent the expiration, then they are pretty dedicated to your app! Also, most people would not know how you checked their subscription so they would probably not think to keep it open.

You should also think about storing their subscription in NSUserDefaults. What if they remove the app and reinstall it? Do you check your database and reload that value into defaults? If it is a small amount of data you could store it in the keychain. The keychain values are not deleted when the app is removed.