我正在通过创建沙盒帐户来测试购买时的Auto Renewal应用程序,一切正常,当即使在其他设备上弹出的应用程序启动似乎登录时,已经充满了沙盒旧电子邮件(现在不存在),我使用这种方法 iPhone inApp Purchase Queue won't clear out
但仍然弹出对话框一次又一次,甚至从iTunes注销,它显示沙盒的旧电子邮件 每次尝试购买时都会运行此方法
func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
for transaction in transactions {
// SKPaymentQueue.default().finishTransaction(transaction)
switch transaction.transactionState {
case SKPaymentTransactionState.purchased:
print("Transaction Approved")
cleanUp()
print("Product Identifier: \(transaction.payment.productIdentifier)")
self.deliverProduct(transaction: transaction)
SKPaymentQueue.default().finishTransaction(transaction)
case SKPaymentTransactionState.failed:
print("Transaction Failed")
cleanUp()
// print("failed :\(transaction.error)")
SKPaymentQueue.default().finishTransaction(transaction)
case SKPaymentTransactionState.restored:
cleanUp()
SKPaymentQueue.default().finishTransaction(transaction)
default:
break
}
}
}
func cleanUp() {
for transaction in SKPaymentQueue.default().transactions {
SKPaymentQueue.default().finishTransaction(transaction)
}
}