bounty将在4天后过期。回答此问题可获得+50声望奖励。Lena Verhoev正在寻找一个规范的答案:想知道为什么交易被列为未完成,而过程显然已经完成。还有,如何解决?
下面的代码。我在调用updatedTransactions后调用SKPaymentQueue.default().finishTransaction(transaction)-不知道为什么Xcode的Storekit Transactions中的transaction状态是unfinished。
internal func purchaseFullVersion() {
if let product = product {
let payment = SKPayment(product: product)
SKPaymentQueue.default().add(payment)
}
}
func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
for transaction in transactions {
switch transaction.transactionState {
case .purchased : purchased(transaction: transaction)
case .failed : failed(transaction: transaction)
case .restored : restored(transaction: transaction)
default : break
}
}
}
internal func purchased(transaction:SKPaymentTransaction) {
SKPaymentQueue.default().finishTransaction(transaction)
print("Purchased")
guard let product = product else { return }
purchaseTransactionComplete() // this updates UserDefaults
}
字符串
1条答案
按热度按时间n6lpvg4x1#
字符串