Reputation: 689
This is the message I get when I press on my restore purchases button. Here is the code I have for restoring the purchases......Can someone tell me if Im doing something wrong. Thank you! BTW If you need more info or code please let me know.
Ignoring restoreCompletedTransactionsWithApplicationUsername: because already restoring transactions
func RestorePurchases() {
if SKPaymentQueue.canMakePayments() {
SKPaymentQueue.defaultQueue().restoreCompletedTransactions()
} else {
println("Can't make purchases")
}
}
func paymentQueueRestoreCompletedTransactionsFinished(queue: SKPaymentQueue!) {
var purchasedItemIDS = []
for transaction in queue.transactions {
var t: SKPaymentTransaction = transaction as! SKPaymentTransaction
let prodID = t.payment.productIdentifier as String
switch prodID {
case "unlockLevelTwo":
println("restoreleveltwo")
unlockLevelTwoPlease()
case "unlockLevelThree":
println("restorelevelthree")
unlockLevelThreePlease()
default:
println("IAP not setup")
}
}
}
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
var touch: UITouch = touches.first as! UITouch
var location = touch.locationInNode(self)
var node = self.nodeAtPoint(location)
if node.name == "restore" {
runAction(menuAudioPlayer)
RestorePurchases()
}
Upvotes: 3
Views: 2055
Reputation: 66302
You're never calling finishTransaction:
with the transaction once it's restored, so it remains in the payment queue.
From the documentation for this method:
Your application should call this method from a transaction observer that received a notification from the payment queue. Calling
finishTransaction:
on a transaction removes it from the queue. Your application should callfinishTransaction:
only after it has successfully processed the transaction and unlocked the functionality purchased by the user.
Upvotes: 1