macos – Different exception handling behaviour in iOS app vs mac catalyst app

0
155


I am seeing two different behaviour in exception handling in iOS app vs mac catalyst app (sharing the same codebase) i.e. let’s say following exception is thrown from the controller:

[NSException raise:@"myException" format:@"myException"];

In case mac catalyst following stack trace comes in logs but the app executions continues i.e. the app does not terminates.

    0   CoreFoundation                      0x00007ff810845e9b __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00007ff8105a7e48 objc_exception_throw + 48
    2   CoreFoundation                      0x00007ff810845d02 +[NSException exceptionWithName:reason:userInfo:] + 0

but in case of iOS app similar stack trace is printed but the execution stops and app crashes with debug pointer at

UIApplicationMain(argc, argv, @"myApp", @"myAppDelegate");     Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1b0f3bd84)

Can someone explain why this happens and how can I make the iOS app also not crash and continue its execution.