本文介绍了应用内购买错误的恢复按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的应用中恢复应用内购买时出现问题
I got a problem while restoring an in-app purchase in my app
我已经在我的项目中应用了这行代码:
I already applied this lines of codes in my project:
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
但它调用此函数
- (void)paymentQueue:(SKPaymentQueue*)queue restoreCompletedTransactionsFailedWithError:(NSError*)error
{
NSLog(@"error");
}
我必须做些什么才能避免出现此错误?并调用此函数:
What must I need to do to avoid getting this error? and call this function:
- (void) paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue
{
NSMutableArray *purchasedItemIDs = [[NSMutableArray alloc] init];
NSLog(@"received restored transactions: %i", queue.transactions.count);
for (SKPaymentTransaction *transaction in queue.transactions)
{
NSString *productID = transaction.payment.productIdentifier;
[purchasedItemIDs addObject:productID];
}
}
先谢谢你们!
推荐答案
我在模拟器测试时遇到了同样的问题。在物理设备上试用它,因为模拟器上没有应用内购买。
I had the same problem while testing from the simulator. Try it on a physical device since in-app purchases are not available on simulator.
这篇关于应用内购买错误的恢复按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!