Iphone completeTransaction:(SKPaymentTransaction*)事务运行多次
我使用下面键入的代码在我的应用程序中处理应用程序内购买。在completeTransaction中,我通过调用ProviderContentForProductIdentifier解锁高级内容。大多数情况下,它只运行一次,但有时会运行多次Iphone completeTransaction:(SKPaymentTransaction*)事务运行多次,iphone,objective-c,ios7,in-app-purchase,Iphone,Objective C,Ios7,In App Purchase,我使用下面键入的代码在我的应用程序中处理应用程序内购买。在completeTransaction中,我通过调用ProviderContentForProductIdentifier解锁高级内容。大多数情况下,它只运行一次,但有时会运行多次 - (void)completeTransaction:(SKPaymentTransaction *)transaction { NSLog(@"completeTransaction..."); [self provideContent
- (void)completeTransaction:(SKPaymentTransaction *)transaction
{
NSLog(@"completeTransaction...");
[self provideContentForProductIdentifier:transaction.payment.productIdentifier];
[self validateReceiptForTransaction:transaction];
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
}
请帮忙 我也有同样的问题。就我而言,我忘了取下TransactionObserver。因此它仍然包含早期的产品id。添加此项可在完成交易后删除购买的产品id
- (void)paymentQueue:(SKPaymentQueue *)queue removedTransactions:(NSArray *)transactions
{
NSLog(@"Purchase removedTransactions");
// Release the transaction observer since transaction is finished/removed.
[[SKPaymentQueue defaultQueue] removeTransactionObserver:self];
}
多少次?在什么条件下?作为补充说明,您可能需要考虑先进行验证,然后只有在成功解锁内容时才进行验证。@ChrisPrince random times,无特定条件。谢谢你的提示!对我来说似乎不正确。任何未处理的交易仍将挂起。