[英]updatedTransactions first time, call old queue
Firs time i tried to make a subscription this function call for all transactions, but after then if i tried to subscribe it calls just 1 state. 第一次,我尝试为所有交易进行此功能的订阅,但是之后,如果我尝试进行订阅,则仅调用1状态。 This code same as in apple developer documentation
此代码与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 is called only for updated transactions (see Apple docs https://developer.apple.com/library/prerelease/ios/documentation/StoreKit/Reference/SKPaymentTransactionObserver_Protocol/ ) 只为更新的事务调用updatedTransactions(请参阅Apple文档https://developer.apple.com/library/prerelease/ios/documentation/StoreKit/Reference/SKPaymentTransactionObserver_Protocol/ )
transactions - An array of the transactions that were updated. 交易-已更新的交易的数组。
But on application start or first purchase iOS sends every transaction from SKPaymentQueue: defaultQueue. 但是在应用程序启动或首次购买时,iOS会从SKPaymentQueue发送所有交易:defaultQueue。
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/DeliverProduct.html : Terminate and relaunch your app. https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/DeliverProduct.html :终止并重新启动您的应用程序。 Store Kit calls the paymentQueue:updatedTransactions: method again shortly after launch;
启动后不久,Store Kit再次调用paymentQueue:updatedTransactions:方法; this time, let your app respond normally.
这次,让您的应用正常响应。 Verify that your app correctly delivers the product and completes the transaction
验证您的应用正确交付了产品并完成了交易
So if app should view all transactions, it should request SKPaymentQueue: defaultQueue. 因此,如果应用程序应查看所有交易,则应请求SKPaymentQueue:defaultQueue。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.