MKStoreKit isFeaturePurchased reporting incorrectly

久未见 提交于 2019-12-04 22:28:12

From what I can see, MKStoreKit calls the completion block whether or not any purchases were restored. You see, there may not have been any purchases to restore even if no errors were encountered.

What you should do to test the restore feature is:

  1. Add to the -application:didFinishLaunchingWithOptions: method of your app delegate:

    [[MKStoreManager sharedManager] removeAllKeychainData];
    
  2. Create a new test account on iTunesConnect.

  3. Use this test account to make a purchase in your app.
  4. Call +isFeaturePurchased: to make sure the purchase was successful (should return YES).
  5. Force close your app and relaunch it so that -removeAllKeychainData gets called.
  6. Call +isFeaturePurchased: to make sure that the app doesn't know that the product has been purchased (should return NO).
  7. Call -restorePreviousTransactionsOnComplete:onError:.
  8. Call +isFeaturePurchased: to make sure the product was restored (should return YES).

Make sure you are using the same test account throughout this process.

As an aside, MKStoreKit doesn't do any receipt checking on iOS7 so you may want to try a more recent library like RMStore instead (appears to be available in cocoapods too).

I got it working, and just in case anyone in the future is having the same problem, here is what I did. I deleted the in-app purchase and created a new one in iTunes Connect, reinstalled MKStoreKit using cocoa pods, re-entered the in-app purchase id into the MKStoreKit plist file, and waited a day and now everything is working just fine!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!