Reputation: 1680
Apple doc says the following:
For example, if a user buys something in your app right before going into a tunnel, your app may not be able to deliver the purchased content if there is no network connection. The next time your app launches, StoreKit calls your transaction queue observer again and your app should handle the transaction and deliver the purchased content.
I wonder if the app receives anything through paymentQueue(_:updatedTransactions:)
when StoreKit failed to finish the purchase in the tunnel?
My first thought was that StoreKit might return SKPaymentTransactionState.failed
with a network connection related error domain or code. But if so, the app would call finishTransaction(_:)
to remove the transaction in the payment queue. As a result, what was described in the last sentence of the above doc would never happen.
So, does that mean in above case StoreKit doesn't return anything and the app seems to be hanging to user? Will user have to kill the app to continue? Or maybe the purchase view (presented by StoreKit) doesn't block the application's UI so user can dismiss the purchase view and continue to use the app (I suppose the app doesn't implement an activity indicator view to block the UI)?
Thanks for any help.
Upvotes: 0
Views: 72
Reputation: 114865
The situation described in Apple's document is that where the purchase has completed on Apple's side, but your app is unable to deliver the content.
For example, the user may have purchased a movie rental. The access to this rental needs to be recorded on your server.
If they enter a tunnel after Apple returns a .purchased
status but before you can get a confirmation from your server that the purchase has been recorded, you wouldn't call completeTransaction
since the transaction isn't complete until the purchase is recorded on your server. You would presumably have a network error or timeout communicating with your server.
The pending transaction would remain in the queue for your app to retry later.
Upvotes: 1