As mentioned in How to know if NSAssert is disabled in release builds?, you can use NS_BLOCK_ASSERTIONS
to know if NSAssert is being overridden to do nothing.
Therefore, you can define your own assertion macro:
#ifdef NS_BLOCK_ASSERTIONS
#define ABCAssert(condition, ...) \
do { \
if (!condition) \
NSLog(__VA_ARGS__); \
} while (0)
#else
#define ABCAssert(condition, ...) NSAssert(condition, __VA_ARGS__)
#endif
Now replace all calls to NSAssert, with ABCAssert. In addition to ensuring that condition is always used, it will log any assertion failures rather than silently ignoring them.
Warning: I haven't tested the code above. When I have more time I will update it to ensure it works properly.
This is similar to Abizer Nasir's coding conventions which defines:
#ifdef DEBUG
#define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__]
#else
#ifndef NS_BLOCK_ASSERTIONS
#define NS_BLOCK_ASSERTIONS
#endif
#define ALog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
#endif
There are a few differences, though: