如何在XCode控制台中按十六进制查找实例?

发布于 2024-09-13 03:44:04 字数 91 浏览 2 评论 0原文

当我在 iPhone 应用程序崩溃后打开控制台时,它经常显示“无法识别的选择器已发送到实例 0x 等等”。我怎样才能知道这是什么变量?调试器中有办法吗?有可能吗?谢谢。

When I bring up console after my iPhone app crashes, it often says "unrecognized selector sent to instance 0x blah blah blah." How can I find out what variable this is? Is there a way in the debugger? Is it even possible? Thanks.

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

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

发布评论

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

评论(2

独守阴晴ぅ圆缺 2024-09-20 03:44:04

在 gdb 中,您可以键入

po 0x12345678

打印该地址处对象的 -description 。但这些信息很少有用。您应该首先检查异常的回溯,这可以找到导致问题的代码行。

In gdb you could type

po 0x12345678

to print the -description of the object at that address. But this info is seldom useful. You should instead check the backtrace of the exception first, which can locate the line of code that causes the problem.

摘星┃星的人 2024-09-20 03:44:04

创建异常断点非常有帮助,在 Xcode 7.3 中,这从未如此简单。这将帮助您找到导致异常的代码行。

输入图像描述这里

  1. 在应用程序崩溃的行上添加断点
  2. 单击“项目导航器”菜单中的断点
  3. 找到您刚刚创建的断点并选择它
  4. 单击左下角的“+”
  5. 选择“添加异常断点”

运行您的代码...每当您收到“无法识别的选择器发送到实例 0x blah blah blah”时,调试器将停止在导致问题的行上。

It's very helpful to create an Exception breakpoint, and with Xcode 7.3, it's never been easier. This will help you find the line of code causing an exception.

enter image description here

  1. add breakpoint on the line where the app crashes
  2. click the breakpoint in the Project Navigator menu
  3. find the breakpoint you just created and select it
  4. click the "+" at the bottom left
  5. Select "Add Exception Breakpoint"

Run your code...whenever you get a "unrecognized selector sent to instance 0x blah blah blah," the debugger will stop on the line that's causing the problem.

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