SKRequest didFailWithError

发布于 2024-11-03 14:46:26 字数 432 浏览 3 评论 0原文

-(void)request:(SKRequest *)request didFailWithError:(NSError *)error  
{

}

通过这种方法,人们可以阻止前发生的错误 - (“无法连接到 iTunes”)等。现在,如果有人想将此错误消息显示为警报,这对用户来说确实很有帮助。例如,当“无法连接到 iTunes”错误显示为 UIAlertView 时,它可能会导致用户遇到 Wi-Fi 一直处于关闭状态的问题。他可以纠正此问题并重试。但在选择将这些错误显示为 UIAlertView 之前,必须知道返回的所有可能的错误值,因为用户不会高兴看到类似“Error %^@)$()(!)#()+”的内容!代码 123_123443 等等”他无法理解。如何最好地处理这个问题?事后想想,如果能知道这个方法中抛出的所有可能的 NSError 错误消息就好了。

提前致谢

-(void)request:(SKRequest *)request didFailWithError:(NSError *)error  
{

}

With in this method one could arrest the error that happened for ex - ("Failed to Connect to iTunes") etc. Now if one wants to show this error message as an alert it would be really helpful for users. Like one example is when the "Failed to Connect to iTunes" error is shown as an UIAlertView, it can lead the user to the problem that his wi-fi was off all this while. He can rectify this problem and retry. But before one chooses to display these errors as UIAlertView, one must know all the possible error values that are returned because a user won't be pleased to see something like "Error %^@)$()(!)#()+! code 123_123443 blah"i.e.something incomprehensible to him. How to best handle this ? As an after thought, it would be nice to know all the possible error messages of NSError thrown in this method.

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

┈┾☆殇 2024-11-10 14:46:26

必须知道所有可能的错误
返回的值是因为
用户不会高兴地看到某些东西
就像“错误%^@)$()(!)#()+!代码
123_123443 废话“iesomething
他无法理解

我不知道特定方法可能返回的所有可能的错误,但我认为使用 NSErrorlocalizedDescription 方法将错误呈现 是足够安全的用户。

来自 Apple 文档

Cocoa 域中的错误对象是
始终本地化并随时准备呈现
给用户,因此他们通常可以
未经进一步评估就提出。

one must know all the possible error
values that are returned because a
user won't be pleased to see something
like "Error %^@)$()(!)#()+! code
123_123443 blah"i.e.something
incomprehensible to him

I don't know all the possible errors that particular method can return but I think it is safe enough to use the localizedDescription method of NSError to present the error to the user.

From Apple docs:

Error objects in the Cocoa domain are
always localized and ready to present
to users, so they can often be
presented without further evaluation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文