Is there a way to catch global "crashing" app exceptions like objc_exception_throw, EXC_ARITHMETIC etc. in code? I need that because I want to do some things before the app gets killed by the system.
Asked
Active
Viewed 3,781 times
4
-
`objc_exception_throw` is not an exception. It is the function that throws Objective-C exceptions. Similarly, `EXC_ARITHMETIC` is not an Objective-C exception; it is a Mach (kernel) exception, meaning that your app tried to do something completely invalid. – Peter Hosey May 14 '10 at 09:14
1 Answers
10
You can set a handler for any uncaught exception by using NSSetUncaughtExceptionHandler
.
The relevant docs from Apple are here: http://developer.apple.com/mac/library/documentation/cocoa/conceptual/Exceptions/Concepts/UncaughtExceptions.html#//apple_ref/doc/uid/20000056-BAJDDGGD

pgb
- 24,813
- 12
- 83
- 113