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. This code same as in apple developer documentation
- (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/ )
transactions - An array of the transactions that were updated.
But on application start or first purchase iOS sends every transaction from SKPaymentQueue: defaultQueue.
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/DeliverProduct.html : Terminate and relaunch your app. Store Kit calls the paymentQueue:updatedTransactions: method again shortly after launch; 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.