Xcode 4 tells me when an NSAssert has failed, but the assert description and backtrace are no longer logged. I have seen this question:
How to make Xcode4 stop at NSAssert failure?
which is helpful, but I would rather log the assertion and continue. How can I make NSAssert behave this way? Thanks!
The question you linked to gets you most of the way there. Add a breakpoint action to the breakpoint you set for the assertion. Select the breakpoint from the breakpoint navigator, right-click, and choose Edit Breakpoint. Choosing Edit Breakpoint opens a pop-up editor. In the pop-up editor you should see an Action line with the text Click to add an action. Click that text to open a menu. Choose Log Message from the Action menu. Select the Automatically continue after evaluating actions checkbox to automatically continue after logging the message.
If you need to log and move on, then you do not need to use NSAssert.
In general, assertions are intended to be used by developers in debug builds to stop the execution of the application immediately when a serious mistake has been detected. By default, Xcode projects set NS_BLOCK_ASSERTIONS in release builds so that NSAssert calls compile out.
For minor issues that only need logging to the console, you should just use NSLog. (The debugger console actually shows the data sent to 'stdout', which is where NSLog sends its results.)
If you need debug versions to assert and release builds to log, just use both. Yes, that means you might have the same description appear twice in the code, but that is fine. It will easily understood by any developer. (You can create the result string first, the feed it to both NSAssert and NSLog if you like.)
If you must override the behavior of an NSAssert call, then you have 2 options:
1- change the macro definition of NSAssert, NSAssert1, NSAssert2, etc to change the result.
2- supply your own NSAssertionHandler object to your threads and have it skip throwing the exceptions.