Add a symbolic breakpoint on a selector in Xcode

女生的网名这么多〃 提交于 2019-12-04 02:54:27

Setting a breakpoint on a selector causes lldb to halt when that selector is executed, not when it is sent. In your case, there is no selector "-[Event boolValue]", therefore this breakpoint will never be hit.

I would set an exception breakpoint on "All Objective-C Exceptions". This will be hit when the "unrecognized selector sent" exception is thrown and you can see where the problem occurs.

I was looking for the same answer (symbolic breakpoints) and this link helped: http://www.cocoabuilder.com/archive/cocoa/308967-symbolic-breakpoints.html#308970

You have to follow this pattern (it is also given as a placeholder in Xcode breakpoint editor):

- [name_of_the_class name_of_the_method:]

For example I was looking to see who does set my left bar item and overrides my settings, I used -[UINavigationItem setLeftBarButtonItem:]

and it worked. Or this one

-[UINavigationController pushViewController:animated:]

I would set an Symbolic breakpoint with this symbol -[NSObject doesNotRecognizeSelector:]

which will help us to capture situations where a selector is being invoked against the wrong object.

It looks to me like symbolic breakpoints don't work right in LLDB (I'm running the most recent released version of Xcode as of this writing, 4.3.3).

I set a symbolic breakpoint at addAnimation:forKey: in LLDB, and it never gets hit. If I switch my project to GDB, the breakpoint works as expected.

Best way to find unrecognized selector call is to create this selector (as category) and put a break point in it.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!