In this case, since it looks like you are traversing the I/O Registry, you can use CFGetTypeId()
:
CFTypeRef device = CFArrayGetValueAtIndex(devices, i); // <-- use CFTypeRef
if(CFGetTypeID(device) == CFDictionaryGetTypeID()) { // <-- ensure it's a dictionary
...
}
If you really need to send messages to NSObject
's interface from your C code, you can (see #include <objc/objc.h>
and friends, or call to a C helper function in a .m file), but these strategies are not as straight forward as CFGetTypeID()
, and much more error-prone.