views:

76

answers:

1

Hi all,

Is there any CoreFoundation handy way for checking a class's pedigree like isKindOfClass ?

Thank you in advance, Vassilis

+2  A: 

Since CoreFoundation is based on "opaque" references, it is difficult to inspect unknown objects. There is no isa-pointer like with a normal objective-c class which you can look at in order to find out about the type of an arbitrary object. However, CF has some functions to offer that can help you: specifically, CFGetTypeID():

CFTypeID type = CFGetTypeID(anObject); 
if (CFArrayGetTypeID() == type)
    printf("anObject is an array.");
else
    printf("anObject is NOT an array.");

See CFType Reference.

VoidPointer
That works. Thanks :-)
VLegakis