in app purchase, SKPaymentTransactionStatePurchased retries
I'm implementing In App Purchase and am validating receipts on my server.
When I encounter SKPaymentTransactionStatePurchased
during paymentQueue:updatedTransactions:
I send the receipt to my server for validation. When my server responds with an OK I call finishTransaction
.
If my server is offline or I'm otherwise unable to validate the receipt, what triggers 开发者_如何学编程the app to call paymentQueue:updatedTransactions:
again, effectively giving me a chance to retry the validation? I've noted that restarting the app does this - is there anything else? Will it get called again on some fixed frequency while the app remains running?
Is there a manual way to force the transaction-queue to cycle?
I think TomSwift doesn't want to restore purchased payment, but he want application to call paymentQueue:updatedTransactions with SKPaymentTransactionStatePurchased flag again of non finishTransaction
and only way he know is re-launch the app
I used to try [[SKPaymentQueue defaultQueue] removeTransactionObserver:mMyStoreObserver]; [[SKPaymentQueue defaultQueue] addTransactionObserver:mMyStoreObserver]; again
but it doesn't work..
the problem of non finishTransaction is apple will said it have been purchased but never been downloaded and it will enter SKPaymentTransactionStateFailed when try to purchased same product id again.
You can have the App call a
[[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
This will send to
paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
a set of all of the transactions with:
SKPaymentTransactionStateRestored
rather than
SKPaymentTransactionStatePurchased
精彩评论