top | item 6906582

(no title)

paintstripper | 12 years ago

That's because blocks aren't completely objective-c objects. They can act like them in some cases, but underneath they are still C based. That's why you pass NULL instead of nil to specify an empty block.

discuss

order

mikeash|12 years ago

All of Objective-C is C based in the end. Blocks are completely Objective-C objects. Attempting to call a NULL block crashes not because blocks aren't Objective-C objects, but because block invocation is not a message send.

Note that accessing an instance variable of a nil Objective-C object pointer will also crash, e.g.:

    obj->_ivar;
That's obviously not because Objective-C objects aren't Objective-C objects. The crash when calling a nil block is the same thing.