The class of an object is again an Objective-C object, so use po
instead of p
:
po [object class]
po
is an abbreviation for expression -o --
and prints the description of the expression.
Your error is caused by the fact that id
is a pointer and must be cast to
NSObject *
, not to NSObject
. So this would work as well:
p [(NSObject *)object class]
Alternatively, cast the method's return type, as suggested by the lldb error message:
p (Class)[object class]
But po
is the simplest solution for your problem.