Currently, my Xcode4 does not stop at NSAssert
failure. How can I make it stop at NSAssert
failure again?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
- Go to the XCode 4 breakpoint navigator.
- Click the + button and choose "Add Symbolic Breakpoint"
- Set Symbol: to "-[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]"
- Click "Done"
Now you will stop in the debugger as soon as NSAssert fires. In my testing, it goes to the nearest source code and doesn't just show you the assembly where you set the breakpoint.
More Generically, you could do this:
- Go to the breakpoint navigator.
- Click the + button and choose "Add Exception Breakpoint"
- Set Exception: to "Objective-C"
- Set Break: to "On Throw"
- Click "Done"
This may be more or less useful depending on your code.
See also the XCode 4 documentation result for "Adding an Exception Breakpoint"
回答2:
i'm boring for the problem. i think blow blog may be useful. http://www.learn-cocos2d.com/tag/nsassert/ http://edmundlong.com/edsBlog/making-nsassert-work/
回答3:
Assertions are automatically disabled, by default, in a Release build. If you want assertions to work, do a Debug build, or turn off the Other C Flags build setting where assertions are turned off in the Release build.