func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
print("sub-update\(transactions.count)")
guard let fobj = transactions.first else { return }
switch fobj.transactionState {
case .purchased:
print("sub-purchased ")
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
self.finsihTrans(trans: transactions)
}
case .restored:
print("sub-restored")
finsihTrans(trans: transactions)
case .failed:
print("sub-failed ")
finsihTrans(trans: transactions)
case .purchasing:
print("sub-purchaing")
default:
finsihTrans(trans: transactions)
}
}
func finsihTrans(trans: [SKPaymentTransaction]) {
for t in trans {
print("sub-finished \(t.transactionIdentifier)-state=-\(t.transactionState)")
SKPaymentQueue.default().finishTransaction(t)
}
}
in iOS13 ,when a user click subscribe button, func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) will callback a purchasing transaction,after user input password, call back a purchased transaction. However,in iOS14.0.1 ,after a user click subcribe button, only callback a restored transaction,that lead subscribe fail alway.Has anyone encountered this kind of problem, please help