开发者

How do I catch global exceptions?

开发者 https://www.devze.com 2022-12-29 23:23 出处:网络
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 bef开发者_如何学Core the app gets killed

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 bef开发者_如何学Core the app gets killed by the system.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消