What? Nil objects don’t have a class; they’re just nil pointers.
_ivarDescriptionprints the expected class of the instance variable, as specified in the source code.
In fact, the compiler stores extended type info in the binary. That’s really weird: Objective-C treats all objects equals, as
ids, and will not complain when assigning an object of a class to a pointer of a different type. I always assumed that class info was lost at runtime; it turns out that’s not true.
As with ivars, methods arguments expect objects of a specific class, and this information is embedded in the binary. For some reason, it’s only available for methods declared in Protocols, and the public runtime API won’t let us access it, but the private function
Maybe someday the runtime will be able to access annotations, too…
Stay up-to-date by subscribing to the Comments RSS Feed for this post.