嗨,我需要在 Inapp-Purchase 中实现恢复功能,因为这创建了一个“恢复”按钮,它正在调用方法
-(void)restorePurchasedProductsWithProductId:(NSString*)prodID
{
_productIdsArray = [[NSMutableArray alloc] init];
productID = [prodID retain];
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
}
它给了我一个输入苹果ID密码的弹出窗口。然后什么都没有发生。
我在某个地方读到它叫
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
所以我确实喜欢这个
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
{
NSLog(@"paymentQueue");
for (SKPaymentTransaction *transaction in transactions)
{
switch (transaction.transactionState)
{
case SKPaymentTransactionStatePurchased:
[self completeTransaction:transaction];
break;
case SKPaymentTransactionStateFailed:
[self failedTransaction:transaction];
break;
case SKPaymentTransactionStateRestored:
NSLog(@"restored");
[self restoreTransaction:transaction];
break;
default:
break;
}
}
}
但问题是上述方法既没有调用 this
- (void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue
也不
-(void)paymentQueue:(SKPaymentQueue *)queue restoreCompletedTransactionsFailedWithError:(NSError *)error
我还包括了所需的协议,
有人可以帮助我为什么这些委托方法不要求恢复过程。我正在尝试使用测试帐户。