Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 1, 2012, 03:48 AM   #1
namanhams
macrumors regular
 
Join Date: Jun 2009
How to check if an object is NSObject or CFTypeRef

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 ?
Thanks.
namanhams is offline   0 Reply With Quote
Old Aug 1, 2012, 04:01 AM   #2
solderguy1
macrumors member
 
Join Date: Apr 2012
I'd say look into these three
isa field
isKindOfClass
respondsToSelector
solderguy1 is offline   0 Reply With Quote
Old Aug 1, 2012, 05:08 AM   #3
Reason077
macrumors 65816
 
Join Date: Aug 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.
Reason077 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 07:46 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC