How can I catch all exceptions on iphone?

I need to catch ALL exceptions and errors in the iphone application. Obviously, this is only for really strange cases when an exception or error is completely unexpected. In these cases, it would be nice to register a bug or something else to find out about the problem and fix it in the future.

Do you know a way to catch ALL exceptions or errors that could be removed from more specific handlers?

Thank!

+3
source share
1 answer

In its work, the application delegate places this function (note that this is not a method, this is a stand-alone function):

// global uncaught exception handler
void uncaughtExceptionHandler(NSException *exception) {
    [FlurryAPI logError:@"Uncaught" message:@"Crash!" exception:exception];
}

DidFinishLaunching *:

    // uncaught exceptions
    NSSetUncaughtExceptionHandler(&uncaughtExceptionHandler);
+10

Source: https://habr.com/ru/post/1752094/


All Articles