Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 794
KlimczakM Avatar asked Feb 14 '14 12:02

KlimczakM


2 Answers

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/

like image 121
Andrew Avatar answered Sep 19 '22 14:09

Andrew


Note that using NSAssert/NSParameterAssert within a block may cause a retain cycle. Use the C variants instead. Google NSAssert retain cycle

like image 42
Mark Krenek Avatar answered Sep 22 '22 14:09

Mark Krenek