iPhone应用内购买:出错时,谁的责任是通知用户?
我有一个完整的应用内购买解决方案,但我想知道我是否正确处理错误。我使用类似于此处 Apple 示例的代码来处理错误;
- (void) failedTransaction: (SKPaymentTransaction *)transaction
{
if (transaction.error.code != SKErrorPaymentCancelled)
{
// Optionally, display an error here.
}
[[SKPaymentQueue defaultQueue] finishTransaction: transaction];
}
但我的问题是 - storekit 会向用户显示相关错误(无法连接、付款被拒绝等)还是我需要始终处理这个问题?从测试来看,当 storekit 工作正常时,它确实会自行处理错误,因此我可以默默地转储它们(好吧,实际上我们将它们记录在另一台服务器上)。
然而,当 storekit 沙盒运行时,我们会收到表明存在问题的随机错误,并且 storekit 本身不会发出任何警报。
遇到错误你们会怎么做?您是否总是提醒用户,或者最终会重复 storekit 已经发出的警报。
谢谢 罗杰
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 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
应用程序有责任处理错误。
操作系统不显示消息,因为要显示什么消息,或者是否显示消息(而不是从表中删除一项)是操作系统无法确定的事情。
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.
我可以确认您必须自己处理此类错误。我在 App Store 中有一款支持 StoreKit 的游戏。请参阅 http://www.appulize.com/index.php?cID=80
当出现问题时,我采用了简单的方法来显示 UIAlert。
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.