Search code examples
iosobjective-cassertnsassert

Is raising NSInternalInconsistencyException guaranteed to crash by default?


I use NSAssert to detect unrecoverable conditions in my code. I enabled assertions in release mode as well because if an assertion fails in my code, it's guaranteed to be unrecoverable.

NSAssert raises NSInternalInconsistencyException and I've read conflicting posts about NSInternalInconsistencyException being caught by some frameworks and thus not crashing the app. Is this correct? I want my app to crash any time an NSAssert fails.

Will it also crash if thrown on background threads such as from a dispatch queue?


Solution

  • It is my understanding (backed by experience) that NO exceptions are guaranteed to cause a crash. The system frequently catches them.