1

I am Using MKStoreKit for autorenewable subscription.

On Button's TouchUpInside method I am using following code..

if([[MKStoreManager sharedManager] isSubscriptionActive:kSubscriptionMonthlyIdentifier]){
  //access to subscription feature
}else{
  //ask user to buy
}

It always returns me false. And ask user to buy.

When I tried to buy again it shows me that You are already subscribed.

  • Is there something that I am doing wrong?

  • Is there any other method to check if subscription is active or not.

  • How should I know that subscription is renewed?

Any help would be appreciated.

Thanks in Advance.

Meghan
  • 1,004
  • 1
  • 15
  • 34

2 Answers2

2

1) You should initialize MKStoreKit by adding [MKStoreManager sharedManager]; in your applicationDidFinishLaunching.

2) You should check, that you correctly fill MKStoreKitConfigs.plist:

you must add your subscriptions in-app ids to Subscriptions dictionary (in format: "subs id" - "subs duration").

In apple documentation you could find info about auto-renewable subs: every renewal of the auto-renewable subscription new transaction would be generated and send to your application. In theory, MKStoreKit must take care about all this stuff, and isSubscriptionActive should work.

Also, you could add button for restoring previous purchases. So, in your case, when user press buy button before calling -isSubscriptionActive call -restorePreviousTransactions, or you can add this button, so user can restore previous transaction^ if he already has bought subscription.

You could add observers for this notifications:

#define kSubscriptionsPurchasedNotification @"MKStoreKitSubscriptionsPurchased"
#define kSubscriptionsInvalidNotification @"MKStoreKitSubscriptionsInvalid"

First notification MKStoreKit generate, when Subscription was renewed (or purchased), second one - when renewing failed.

Mikhail Viceman
  • 604
  • 3
  • 9
  • Thanks for input 1. & 2. Already Done. I can purchase product Id and also get notification when purchase done or failed. :( How can I know when auto subscription is done? – Meghan Oct 29 '12 at 12:59
  • Have i answered your question, or what did you mean by "How can I know when auto subscription is done", may be i've misunderstand you? – Mikhail Viceman Oct 29 '12 at 13:18
  • but -restorePreviosTransactions asks user to login. – Meghan Oct 29 '12 at 13:39
  • Yes, because of this it's better to add special button for restoring previous transaction - or ask user for his password twice. – Mikhail Viceman Oct 29 '12 at 13:46
  • but when user subscribed It should auto renew. Not every time ask user for login.. – Meghan Oct 29 '12 at 13:50
  • Yes, but if user will reinstall your app, you must provide a possibility to restore purchases, and also restore your subsctption – Mikhail Viceman Oct 29 '12 at 14:23
  • If user reinstall app, there is an option to restore purchases. But My problem is when subscription is over app must auto renew, should not ask user for password unless he logged out from settings. Subscription should auto renew when its over unless user logged out. – Meghan Oct 29 '12 at 14:46
  • In theory, MKStoreKit must care about renewing of subscription. But, when you test your app in sandbox, subscription automatically renews only 6 times, and 1 month of subscription = 1 hour when you work in sandbox – Mikhail Viceman Oct 29 '12 at 15:20
  • According to http://stackoverflow.com/a/8746286/566431 1 month = 5mins. And subscription renews 5 times for one test user in sendbox. – Meghan Oct 29 '12 at 19:35
0

There is an open issue on the MKStoreKit GitHub that might be related to what you are experiencing. The people in that thread claim that after the app is initialized MKStoreKit always returns NO for isSubscriptionActive. It seems they were able to successfully use a previous release of MKStoreKit, though. You might want to try that.

Michael Frederick
  • 16,664
  • 3
  • 43
  • 58