gpt4 book ai didi

ios - 第一次更新事务,调用旧队列

转载 作者:行者123 更新时间:2023-12-01 16:35:16 24 4
gpt4 key购买 nike

第一次,我尝试为所有交易进行此功能的订阅,但是在此之后,如果我尝试进行订阅,它将仅调用1状态。
此代码与Apple开发人员文档中的代码相同

- (void)paymentQueue:(SKPaymentQueue *)queue
updatedTransactions:(NSArray *)transactions
{
for (SKPaymentTransaction *transaction in transactions) {
switch (transaction.transactionState) {
case SKPaymentTransactionStatePurchasing:
NSLog(@"purchasing in progress");
break;
case SKPaymentTransactionStateDeferred:
NSLog(@"Stade deferred");
break;
case SKPaymentTransactionStateFailed:
NSLog(@"State failed");
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
break;
case SKPaymentTransactionStatePurchased:
NSLog(@"Sucsess purchased");
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
break;
case SKPaymentTransactionStateRestored:
NSLog(@"restored");
break;
default:
// For debugging
NSLog(@"Unexpected transaction state %@",@(transaction.transactionState));
break;
}
}
}

最佳答案

只为更新的交易调用updatedTransactions(请参阅Apple文档https://developer.apple.com/library/prerelease/ios/documentation/StoreKit/Reference/SKPaymentTransactionObserver_Protocol/)

交易-已更新的交易的数组。

但是,在应用程序启动或首次购买时,iOS会从SKPaymentQueue发送所有交易:defaultQueue。

https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/DeliverProduct.html:
终止并重新启动您的应用程序。启动后不久,Store Kit再次调用paymentQueue:updatedTransactions:方法;这次,让您的应用正常响应。验证您的应用正确交付了产品并完成了交易

因此,如果应用程序应查看所有交易,则应请求SKPaymentQueue:defaultQueue。

关于ios - 第一次更新事务,调用旧队列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28881751/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com