Hello,
So i have a problem.
I have 2 in-app purchases, both non-consumables. I can buy them and everything, but when it comes to restoring them is where it gets screwy.
When i create a new sandbox tester and hit my restore purchase button, it calls the restore purchases function but i hadnt made any purhcases on that account. And i do not know how to make it check which in app purchase has already been purchased, and which part of the code to call based on this finding.
This is the code I call when i click the restore button:
}else if nodeArray.first?.name == "Restore"{
if SKPaymentQueue.canMakePayments() == true{
SKPaymentQueue.default().add(self)
SKPaymentQueue.default().restoreCompletedTransactions()
}
and heres the restore func
func paymentQueueRestoreCompletedTransactionsFinished(_ queue: SKPaymentQueue) {
for transaction in queue.transactions {
let t: SKPaymentTransaction = transaction
let prodID = t.payment.productIdentifier as String
switch prodID {
case "com.Carawind.FlipFlop.RemoveAds":
AdBtn = true
UserDefaults.standard.set(true, forKey: "RemovedAds")
RemoveAdsBtn.removeFromParent()
self.viewController.HideAds()
break
default:
break
}
}
}
I havent added the other in app purchase to this function but how do I make it decide which in-app purchase to restore? and why does it restore the purchases even though the test account hadnt bought any?
if you have any answers, can you please provide an example. Thank you