iphone in-app purchase: On error, whose responsibility is notifying the user?
I have a complete in app purchase solution but am wondering if I am handling errors correctly. I handle errors using code similar to the Apple example here;
- (void) failedTransaction: (SKPaymentTransaction *)transaction
{
if (transaction.error.code != SKErrorPaymentCancelled)
{
// Optionally, display an error here.
}
[[SKPaymentQueue defaultQueue] finishTransaction: transaction];
}
But my question is - WILL the storekit display relevant errors to the user (unable to connect, payment declined etc) OR do I need to always handle this? It 开发者_StackOverflow社区seems from testing that when the storekit is working OK, it does indeed handle errors itself, so I can silently dump them (well, in fact we log them on another server).
However when the storekit sandbox is playing up, we get random errors that indicate a problem, and NO alerts from the storekit itself.
What do you guys do with errors? Do you always alert the user or will that end up duplicating alerts that the storekit has already given.
Thanks Roger
It is the app's responsibility to handle errors.
The OS doesn't display a message because what message to display, or whether to display one at all (as opposed to, say, removing an item from a table) is something the OS can't know for certain.
I can confirm you must handle this type of errors yourself. I have a StoreKit enabled game in the App Store. See http://www.appulize.com/index.php?cID=80
I took the simple approach to display an UIAlert when something goes wrong.
精彩评论