我遇到了一些用户支付In-App-Purchase的问题,但应用程序没有对此作出反应;因此我的问题是这样处理是否正确:
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
for (SKPaymentTransaction *transaction in transactions) {
switch (transaction.transactionState) {
case SKPaymentTransactionStatePurchasing:
break;
case SKPaymentTransactionStatePurchased:
[self handlePurchase]; // seems like this isn't called sometimes
// Remove the transaction from the payment queue.
[queue finishTransaction:transaction];
break;
case SKPaymentTransactionStateFailed:
// Remove the transaction from the payment queue.
[queue finishTransaction:transaction];
[self handleCancel];
break;
case SKPaymentTransactionStateRestored:
[self handlePurchase]; // or this isn't called someimtes
// Remove the transaction from the payment queue.
[queue finishTransaction:transaction];
break;
default:
break;
}
}
}
队列处理是否正确? finishTransaction
究竟做了什么?它应该仅在成功案例中被调用吗?