Is there a simple way of throwing the exception generated by an NSAssert when the condition is false? To draw a parallel of what I'm asking for: In C stdlib a failed assert results in a printf() and abort(). And in Java, a failed assert results in a java.lang.AssertionError. In ObjectiveC a failed assert seems to result in (copied from NSException.h):
[[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd
object:self file:[NSString stringWithUTF8String:__FILE__]
lineNumber:__LINE__ description:(desc), ##__VA_ARGS__];
The best equivalent I can think of is either putting the above block in a macro I define (let's call it NSFail()), or using NSAssert(NO, ...). The NSFail macro is a little undesirable since it seems like I'm defining something that essentially already exists. The NSAssert(NO,...) option is undesirable because I don't want the code disabled when NS_BLOCK_ASSERTIONS is defined.