Creating Retain Cycles by Misusing Assertions
Evadne Wu (via Kevin Ballard):
When you use
NSAssert
, ultimately the expanded code contains a reference toself
and_cmd
, inside whatever method the line was used. This also prohibits use ofNSAssert
in a block, because it creates a retain cycle. Just useNSCAssert
which looks slightly wonky but does not require being used within an Objective-C method, and does not allow the programmer to accidentally create retain cycles.