Question

Hello friends i just want to know some couple of questions:

  1. MKStoreKit is good to use for auto renew subscription or does it have any loophole because i am using it for subscribing multiple product for a limited time period using a built in model.?

  2. I am using MKStoreKit to handle autorenewable subscriptions. I'm currently testing a 1 month subscription (in test a subscription lasts 5 minutes). After I purchase the subscription I wait for it to expire. Once it expires I check if the subscription is still active. This returns false like I would expect. However, since it is auto-renewing, I would expect MKStoreKit at that point to contact Apple to revalidate the subscription.

  3. Is it my respossibility to handle auto renew subscription when it expire, i mean to say that i have to implement observer of kSubscriptionsPurchasedNotification notification in my app.

Thanks in advance

Was it helpful?

Solution

I had this question a while back too.

  1. MKStoreKit is not an ideal solution now because it doesn't support iOS7 and the new App Receipt system.

2-3. Apple documentation explains that they renew the receipt in the 24h prior to expiration, and then:

After a subscription is successfully renewed, Store Kit adds a transaction for the renewal to the transaction queue. Your app checks the transaction queue on launch and handles the renewal the same way as any other transaction. Note that if your app is already running when the subscription renews, the transaction observer is not called; your app finds out about the renewal the next time it’s launched.

Your app "checks the transaction queue on launch" and you need to set a SKPaymentTransactionObserver via

[[SKPaymentQueue defaultQueue] addTransactionObserver:yourTransactionObserver];

to handle:

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions

just like you would when you first subscribe.

While testing, you could try to force close your app and then re-launch it after it expires to see if it successfully renews on launch. Alternatively, you can re-verify the receipt you saved from the original subscription. The verification server returns a new receipt if a renewal occurred, and then you can get the most recent expiration date from that.

I've put my autorenewable subscription implementation on github if you want to check it out. RMStore is another library that supports iOS7 and works for other types of purchases too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top