I have a bunch of C functions in my Objective-C project iOS app, that can potentially crash. I want to be able to handle those crashed. At first, I thought to use @try-catch mechanism, but as far as I understand, all exceptions inside this block must be thrown to be handled. Is it true? How can I solve my problem?
For example, this is a call of a C function in Objective-C code. Potentially this function can crush.
err = mailimap_list(session, "", "*", &allList);
Long story short: you can’t.
Long explanation: C doesn’t have “exceptions”. If C code crashes, that’s something fatal concerning the life of the process. For example, a detected segmentation fault will make the OS terminate your process. These are not nice Obejctive-C-style exceptions which can be handled.