When performing introspection on a class, I use the following code:
if([object isKindOfClass:[NSNumber class]]){
NSLog(@"I am an NSNumber: %@", object);
}
NSLog(@"Properties:%@", [object class]);
The output is:
I am an NSNumber: 320
Properties:__NSCFNumber
Can anyone explain why the result is __NSCFNumber for type NSNumber? I also noticed NSArray is identified as:
__NSArrayI
NSNumberis a class cluster. NSNumber is the abstract, public superclass of several concrete subclasses. When you create anNSNumberwith any of the+numberWith...methods, you will get an instance of one of these subclasses.When you pass an object to NSLog() as a parameter corresponding to a “%@” storage specifier,
NSLog()will send that object a-descriptionmessage, and insert whatever’s returned from that message expression into the string it writes to the stderr file descriptor.