Try Catch 语句在模拟器上不起作用(但在 iPhone 上起作用!!!)

发布于 2024-09-14 02:24:55 字数 493 浏览 3 评论 0原文

我的代码中有一个异常捕获语句,如下所示:

@try {
      for(NSDictionary* s in users)
      {
           do something ....
      }
 }
 @catch (NSException * exception) {
      NSLog(@"APIRequesetBase readUserInfo: Caught %@: %@", [exception name], [exception reason]);
 }
 @finally {

 }

所以这个 try 语句在 iphone 设备上完美运行,它可以捕获异常。 然而,在模拟器上,它永远无法捕获异常。它只是崩溃了!

我还尝试其他简单的 try catch 语句来测试它, 并且模拟器永远无法捕获异常。它只是简单地崩溃了!

这个问题太奇怪了。 以前有人遇到过这个问题吗?

还是因为设定的原因?

谢谢

I have an Exception catching statement in my code, like the following:

@try {
      for(NSDictionary* s in users)
      {
           do something ....
      }
 }
 @catch (NSException * exception) {
      NSLog(@"APIRequesetBase readUserInfo: Caught %@: %@", [exception name], [exception reason]);
 }
 @finally {

 }

So this try statement works perfectly on the iphone device, it can catch the exception.
However, on simulator, it can never catch the exception. It just crashes!!

I also try other simple try catch statement to test it,
and the simulator can never catch the exception. It just simply crashes!!

This issue is so strange.
Does anyone have this issue before?

Or is it because of the setting?

Thanks

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

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

发布评论

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

评论(1

乜一 2024-09-21 02:24:55

这是一个已知错误,将在未来版本中修复。

This is a known bug that will be fixed in a future release.

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