0

如果购买确认弹出窗口可见,则支付交易状态是什么?

假设是 SKPaymentTransactionStatePurchasing,我似乎无法让它工作。

4

1 回答 1

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

这仅在用户取消或确认应用内购买后才会发生。

来源:http: //developer.apple.com/library/ios/#documentation/StoreKit/Reference/SKPaymentTransaction_Class/Reference/Reference.html

于 2013-05-27T19:24:34.753 回答