Xcode catch all uncaught exceptions Xcode catch all uncaught exceptions xcode xcode

Xcode catch all uncaught exceptions


You can put a top-level try/catch at your threads' entries.

You may also be interested in NSSetUncaughtExceptionHandler.

Normally, top level handlers are of little utility in production (you're really not attempting to recover from a problem you aren't prepared to handle, but it may be useful for last words or breakpoints). Ideally, you would guard your exits from those library interfaces with a try/catch if and only if you could handle the the exception. Either that, or nothrow as a quick debugging utility during development.

If you're trying to catch Cocoa exceptions -- just let it die and file bugs to whoever thought Cocoa exceptions were supposed to be recoverable.