在确认您的应用内购买后,我将取消购买。在 iOS 6.1 中取消后,控制转移到- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
方法。
在 iOS 5.1 中,不会调用任何委托方法。所以我无法控制取消交易的应用程序。
我购买产品的代码:
- (void)buyProduct:(SKProduct *)product
{
NSLog(@"Buying %@...", product.productIdentifier);
SKPayment * payment = [SKPayment paymentWithProduct:product];
[[SKPaymentQueue defaultQueue] addPayment:payment];
}
委托方式:
#pragma mark SKPaymentTransactionOBserver
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
NSLog(@"updated transactions");
for (SKPaymentTransaction * transaction in transactions) {
switch (transaction.transactionState)
{
case SKPaymentTransactionStatePurchased:
[self completeTransaction:transaction];
break;
case SKPaymentTransactionStateFailed:
[self failedTransaction:transaction];
break;
case SKPaymentTransactionStateRestored:
[self restoreTransaction:transaction];
case SKPaymentTransactionStatePurchasing:
NSLog(@"SKPaymentTransactionStatePurchasing");
break;
default:
break;
}
};
}
请让我知道是什么问题。