Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apple rejected my App due to restore IAP

I have a Restore button. The problem is if they havent' done a restore, and they try to purchase an item, and they have already purchased that item, I need to tell them they already purchased it and not perform the purchase. So I need a way to know, without doing a restore, which items they've purchased. I tried doing a restore first, whenever the user tries to purchase, but apple rejected my app. They said a restore cannot occur before the Confirm In-App Purchase dialog is displayed.

Please help me to find the right way.

Thanks in advance.

like image 429
MadhuP Avatar asked May 06 '13 12:05

MadhuP


People also ask

What does restore IAP mean?

Restoring purchases is a mechanism by which your user can restore their in-app purchases, reactivating any content that had previously been purchased from the same store account (Apple, Google, or Amazon).

What happens when you hit restore purchases on an app?

Restoring purchases prevents you from losing all the things that have been purchased on the old devices. All you need to do is sign in with your old Apple ID or Google Account credentials and you would have restored your purchases. Pretty simple, correct? This menu is available on the side menu of your app.

How do I reinstate in app purchases?

Open the drawer from the upper left corner of the screen and select Support. Select Purchases and Paid App from the menu. Tap on the menu option, located in the upper right-hand corner of the screen. Tap on Recover Paid App.


1 Answers

You can keep those data in NSUserDefaults. And you don't need to show an Alert saying that the items are already purchased. If its a non-consumable product apple is showing the alert saying that they have already purchased that item!

EDIT:

1) You need to add 3 buttons to your view

  • Buy Button
  • Restore Button
  • Demo Version

You need to give the user the restore option if you supports in-app purchases in your app. Otherwise Apple will reject your app.

2) If the user press the Buy Button, don't check whether the user has already purchased your app or not. Because Apple won't charge the users twice for the same non-consumable product. So just go through your buying code and if the the user has already purchased it Apple's StoreKit framework will call it's delegate method

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

with

SKPaymentTransactionStatePurchased

transaction state. So you can present him the login screen.

3) If the user press the Restore Button just go through with your restore code

[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];

and like in the 2nd step it will call the delegate method with the same transaction state. So you can present the login page to the user.

4) If the user press the Demo version button, Present him the demo version.

5) If a user purchased your app, Deleted it and if he re-install it, treat him as a new user. Present him those 3 buttons and the user can restore the purchase and then you can present him the login page.

6) If you really need to keep on track whether the app is purchased on a exact device, then you can use the Keychain to store your data, because the Keychain items are not deleted even if the app is Uninstalled or removed. This Api will help a lot link, have a look

or

You can refer to Apple's documentation on Keychain data

like image 199
Ushan87 Avatar answered Sep 22 '22 11:09

Ushan87