在 Xcode 中,如何在块内添加断点?
我有一个返回块的方法。我想在块内添加一个断点。在 Xcode 中,在块内的行上添加断点会导致执行在方法返回时暂停,而不是在执行块时暂停。如何在块内添加断点?
I have a method which returns a block. I want to add a breakpoint inside the block. In Xcode adding a breakpoint on a line that's inside the block causes execution to pause when the method is returned and not when the block is executed. How do I add a breakpoint inside a block?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我遇到了同样的困难,直到我尝试使用 Xcode 4 的 LLDB 调试器(转到“产品>编辑方案”将其打开)。也许你会有更好的运气。
I had the same difficulty, until I tried using Xcode 4's LLDB debugger (go to Product>Edit Scheme to turn it on). Perhaps you'll have better luck with it.
来自 文档
您可以设置断点并单步执行到块中。您可以使用 invoke-block 从 GDB 会话中调用块,如以下示例所示:
如果要传入 C 字符串,则必须引用它。例如,要将此字符串传递到 doSomethingWithString 块,您可以编写以下内容:
From the documentation
You can set breakpoints and single step into blocks. You can invoke a block from within a GDB session using invoke-block, as illustrated in this example:
If you want to pass in a C string, you must quote it. For example, to pass this string into the doSomethingWithString block, you would write the following: