}else if nodeArray.first?.name == "Restore"{
if SKPaymentQueue.canMakePayments() == true{
SKPaymentQueue.default().add(self)
SKPaymentQueue.default().restoreCompletedTransactions()
}
func paymentQueueRestoreCompletedTransactionsFinished(_ queue: SKPaymentQueue) {
let alert = UIAlertController(title: "Completed", message:"All your previous purchases have been restored", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default) { _ in })
let rootVC = UIApplication.shared.keyWindow?.rootViewController
rootVC?.present(alert, animated: true){}
}
func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
for transaction: AnyObject in transactions {
let trans = transaction as! SKPaymentTransaction
switch trans.transactionState {
case .purchased, .restored:
let prodID = p.productIdentifier
switch prodID {
case "com.Carawind.FlipFlop.RemoveAds":
AdBtn = true
UserDefaults.standard.set(true, forKey: "RemovedAds")
RemoveAdsBtn.removeFromParent()
self.viewController.HideAds()
default: break
}
queue.finishTransaction(trans)
case .failed:
queue.finishTransaction(trans)
break
default:
break
}
}
}I am using a sandbox tester account to try to restore the purchases, but nothing happens besides giving me the alert that I created. Any help is welcome. Thank you