Xcode 断点 [NSExceptionRaise] 与 -[NSExceptionRaise]

发布于 2024-08-12 15:03:46 字数 499 浏览 3 评论 0原文

Xcode:Run>Show>Breakpoints

我已经添加了必需的 [NSExceptionRaise]objc_exception_throw 但当我关闭时Breakpoints 窗口然后返回 Xcode 添加第三个断点:-[NSExceptionRaise]。这是否意味着 [NSExceptionRaise] 是错误的并且我应该删除它? 或者它们都有帮助?如果是的话,它们在功能上有何不同?

替代文本

Xcode:Run>Show>Breakpoints

I've added the obligatory [NSExceptionRaise] and objc_exception_throw yet when I close the Breakpoints window and then return Xcode adds a third breakpoint: -[NSExceptionRaise]. Does this mean [NSExceptionRaise] is wrong and I should delete it? Or are they both helpful? If so in what way are they functionally different?

alt text

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

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

发布评论

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

评论(3

丢了幸福的猪 2024-08-19 15:03:46

正确的断点是:

-[NSException raise]

您指示调试器在 NSException 类的 -raise 方法上中断。 “[NSExceptionRaise]”是(没有不尊重的意思)废话。 :-)

据我所知,你不需要两者。 objc_exception_throw 是“新”方式,而 -[NSException raise] 是“旧”方式。我相信如果您使用的是 Leopard 或更高版本,则只会调用 objc_exception_throw 。 10.4 或之前版本将调用 -[NSException raise]。

The correct breakpoint is:

-[NSException raise]

You're instructing the debugger to break on the -raise method of the NSException class. "[NSExceptionRaise]" is (meaning no disrespect) nonsense. :-)

You don't need both, as far as I know. objc_exception_throw is the "new" way, whereas -[NSException raise] is the "old" way. I believe if you're on Leopard or later, only objc_exception_throw will be called. 10.4 or prior will call -[NSException raise].

万人眼中万个我 2024-08-19 15:03:46

新添加的断点是-[NSException raise],它与[NSExceptionRaise]不同,后者是一个对象方法(NSException是类,raise 是消息)。我不知道后者是什么,我怀疑 XCode 试图智能地了解你输入的内容和它认为你的意思。

The newly added breakpoint is to -[NSException raise], which is distinct from [NSExceptionRaise] in that the latter is an object method (NSException being the class, raise being the message). I don't know what the latter is, and I suspect XCode is trying to be intelligent about what you entered v. what it thinks you meant.

星星的軌跡 2024-08-19 15:03:46

您必须在方法前面加上加号或减号字符,因为调试器使用标头来定位和定义符号。不同的方法可以具有相同的名称,但以“+”开头的方法是类方法,以“-”开头的方法是实例方法。如果没有加号或减号,调试器就不知道您想要什么方法。

You have to preface the method with either a plus or minus character because the debugger uses the headers to locate and define the symbol. Different methods can have the same name but methods prefaced by a "+" are class methods and those prefaced by "-" are instance methods. Without the plus or minus the debugger has no idea what method you wanted.

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