Validate and Verify In-App purchase Non-Renewable iOS

336 Views Asked by At

Third time apple rejected the binary due to In-App purchase type. Am app using IAP to subscribe the package for 1Month, 1Year and Free. Earlier I used Consumable so, app rejected and suggested to use "Non-Renewable". Am following the tutorial "https://www.raywenderlich.com/36270/in-app-purchases-non-renewing-subscription-tutorial". I have downloaded the "VerificationController" class files from the tutorial to verify the transaction. But, am getting many errors,

VerificationViewController.m
No visible @interface for 'VerificationController' declares the selector 'encodeBase64:length:'
No visible @interface for 'VerificationController' declares the selector 'decodeBase64:length:'
Implicit declaration of function 'checkReceiptSecurity' is invalid in C99
Conflicting types for 'checkReceiptSecurity'
Missing context for method declaration

CommonDigest.
Missing '@end'

Can anyone please help to resolve this and submit the app today?

2

There are 2 best solutions below

0
David On

I just fixed this with tkdkop answer on this thread : XCode 6 verificationController.m issues. Hope this can help and save some time to others.

0
abdimuna On

Let me share my idea on this: First of all, Non-renewable subscription is the most tricky to handle in all subscriptions. Its up to developer to handle:

  1. Subscription expiration date
  2. Tracking subscription
  3. Not to mention you have to provide restore button, so that users can restore their purchases

Here is how I handled mine: I use combination of iCloud and backend server to track important data.

  1. Whenever user subscribes to non renewable (i.e purchases it), I store purchase date, and create expiration date equivalent to one month from purchase date in backend server and in iCloud . Note my subscriptions were for one month only. In iCloud store storeUserPurchase.set(key: nrs_key, vale: someData)
  2. Whenever a subscribed user want to access material subscribed to, I check if the expiration date based on some unique id stored in user's iCloud, using this unique id, I ask my server to compute the expiration date based on this id. If hasn't expired then give access to material. Something like purchaseInfo = getSomePurchaseDataFor(key: nrs_key) serverValidateReceiptAndGetExpirationDateFor(receipt, purchaseInfo)
  3. I forgot to mention with all those verifications goes along with receipt validation which is done in back end server too.

Restore purchases: You have to provide this functionality otherwise your app will be cold rejected by Apple.

Here is the tutorial worth reading

In-App Purchase FAQ