• Frank Tyger

    Doing what you like is freedom. Liking what you do is happiness.

IOS Restoring Purchased Products

in app purchase ios

Users restore transactions to maintain access to content they’ve already purchased. For example, when they upgrade to a new phone, they don’t lose all of the items they purchased on the old phone. Include some mechanism in your app to let the user restore their purchases, such as a Restore Purchases button. Restoring purchases prompts for the user’s App Store credentials, which interrupts the flow of your app: because of this, don’t automatically restore purchases, especially not every time your app is launched.

If you submit app to store without button “Restore Purchase” maybe reject

In app purchases restore ButtonHow to solve problem ?
In your app declare function (Swift 2.0)

@IBAction func restorePurchase(sender:UIButton){
    SKPaymentQueue.defaultQueue().addTransactionObserver(self)
    SKPaymentQueue.defaultQueue().restoreCompletedTransactions()
}

func paymentQueueRestoreCompletedTransactionsFinished(queue: SKPaymentQueue) {
    print("received restored transactions: %i", queue.transactions.count);
    if(queue.transactions.count > 0){

        let productIdentifiers = NSSet(array: [PRODUCT_ID])
        let productRequest = SKProductsRequest(productIdentifiers: productIdentifiers as! Set<String>)

        productRequest.delegate = self
        productRequest.start()
    }else{
        UIAlertView(title: "Notice", message: "You don't buy. Please buy for remove ads", delegate: nil, cancelButtonTitle: "OK").show()
    }
}

Good luck

Drop a comment

Your email address will not be published. Required fields are marked *