Re: isKindOfClass returns null instead of YES or NO
Re: isKindOfClass returns null instead of YES or NO
- Subject: Re: isKindOfClass returns null instead of YES or NO
- From: Bill Bumgarner <email@hidden>
- Date: Wed, 20 May 2009 20:42:51 -0700
Welcome to Cocoa / iPhone programming!
On May 20, 2009, at 8:43 AM, Jeff Decker wrote:
NSLog(@"Is Kind of NSString: %@", [[step class] isKindOfClass:
[NSString class]]);
Follow the trail o' definitions... cmd-double-click on isKindOfClass:
ought to lead you to this:
- (BOOL)isKindOfClass:(Class)aClass;
And cmd-double-click on the BOOL return type will lead here:
typedef signed char BOOL;
Thus, a BOOL is not an object. The only reason why your code didn't
crash is because NO is coincidentally equivalent to Nil/NULL/nil. If
it had returned YES, you would have crashed on the above line of code.
So... how to turn a BOOL into a string? For purposes of debugging, I
would do:
NSLog(@"Is Kind of NSString: %@", [[step class] isKindOfClass:
[NSString class]] ? @"YA!" : @"NoWayMan");
But that's just me...
b.bum
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden