• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: isKindOfClass returns null instead of YES or NO
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >isKindOfClass returns null instead of YES or NO (From: Jeff Decker <email@hidden>)

  • Prev by Date: Re: isKindOfClass returns null instead of YES or NO
  • Next by Date: Setting the cursor position to particular point
  • Previous by thread: Re: isKindOfClass returns null instead of YES or NO
  • Next by thread: Re: isKindOfClass returns null instead of YES or NO
  • Index(es):
    • Date
    • Thread