VLegakis
VLegakis

Reputation: 470

Core Foundation respective for isKindOfClass?

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

Upvotes: 0

Views: 528

Answers (1)

VoidPointer
VoidPointer

Reputation: 17831

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.

Upvotes: 6

Related Questions