Search code examples
iosobjective-cassertnsassert

NSAssert vs NSCAssert


What is the difference between NSAssert and NSCAssert? When I explored their implementation they looked very similar and I couldn't find an answer to my question.

I guess that it will also explain the difference between NSParameterAssert and NSCParameterAssert.


Solution

  • The second is the difference between C and Objective-C assertions: NSAssert should only be used in an Objective-C context (i.e. method implementations), whereas NSCAssert should only be used in a C context (i.e. functions).

    More at http://nshipster.com/nsassertionhandler/