如果在购买确认弹出窗口可见时有什么支付交易状态?
假设是SKPaymentTransactionStatePurchasing,我似乎无法让它工作。
答案 0 :(得分:0)
枚举SKPaymentTransactionStatePurchasing是指App Store正在处理的交易,而不是处于“购买”应用内购买状态的用户。
相关的方法
-(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
for(SKPaymentTransaction *transaction in transactions) {
NSString *productId = transaction.payment.productIdentifier;
if(transaction.transactionState == SKPaymentTransactionStateFailed) {
[self paymentTransactionFailed:transaction.error.code];
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
}
and so on for the other enums
应该从调用
-(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
if([response.products count] > 0) {
SKProduct *product = [response.products objectAtIndex:0];
SKPayment *paymentRequest = [SKPayment paymentWithProduct:product];
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
[[SKPaymentQueue defaultQueue] addPayment:paymentRequest];
}
handling more than one product in the response if necessary
仅在用户取消或确认应用内购买后才会发生。