今天在看Facebook的KVOController源码的时候,里面除了使用 NSAssert以外 还使用了 NSCAssert这个更少人用的。 就想起了之前遇到的一个由它引发的问题,顺便记录回忆下。more在苹果的SDK中可以看到这两个都是定义的宏NSAssert 的定义如下:#define NSAssert(condition, desc, ...) \
do { \
__PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \
if (!(condition)) { \
[[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd \
object:self file:[NSString stringWithUTF8String:__FILE__] \
lineNumber:__LINE__ description:(desc), ##__VA_ARGS__]; \
} \
__PRAGMA_POP_NO_EXTRA_ARG_WARNINGS \
} while(0)
#endifNSCassert的定义如下:#define NSCAssert(condition, desc, ...) \
...
继续阅读
(32)