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

Similar Threads
thread Thread Starter Forum Replies Last Post
Resolved: How do I convert an NSData object to an NSDictionary object, and vice versa? moonman239 iPhone/iPad Programming 6 May 2, 2014 01:17 PM
How to check log files to date/time system RAM was changed? Any way to check this? asterix2k10 OS X 1 Mar 7, 2014 08:19 PM
When do you not need to declare an object? thedon1 iPhone/iPad Programming 4 Jul 1, 2013 07:56 AM
The I may go to bed, and just check back in tomorrow to check my order status thread lsutigerfan1976 iPhone 0 Sep 14, 2012 10:50 PM
Need advice - Check NSString object to see if its a valid word? animefx iPhone/iPad Programming 9 Aug 31, 2012 03:02 PM

Forum Jump

All times are GMT -5. The time now is 09:52 PM.

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

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