How to check if an object is NSObject or CFTypeRef

Discussion in 'iOS Programming' started by namanhams, Aug 1, 2012.

  1. namanhams macrumors regular

    Jun 3, 2009
    I have an object of type (id). This object is either a ABRecordRef, or an instance of a class that is subclass of NSObject.

    How do i determine the real type of this object ?
  2. solderguy1 macrumors member

    Apr 20, 2012
    I'd say look into these three
    isa field
  3. Reason077 macrumors 68020


    Aug 14, 2007
    ABRecordRef is a C type - it should not be stored in the ObjC type "id"!

    Normally, if you want to test if an ObjC object is a particular class, you do it like the following:

    "if ([obj isKindOfClass: [MyObjCClass class]]) ..."

    But again, you should not be calling isKindOfClass (or any other ObjC method) on an instance of ABRecordRef - it is not an ObjC type.

Share This Page