How Assertions Work

In your code you make an assertion using an assertion macro. These macros evaluate a condition and, if the condition evaluates to false, they pass a string (and possibly additional printf-style arguments formatted into the string) describing the failure to their NSAssertionHandler. Each thread has its own NSAssertionHandler object created for it. When invoked with an assertion, an NSAssertionHandler prints an error message that includes the method and class (or function) containing the assertion and then it raises an NSInternalInconsistencyException.