• 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: Nil items in NSMutableSet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nil items in NSMutableSet


  • Subject: Re: Nil items in NSMutableSet
  • From: Jens Alfke <email@hidden>
  • Date: Tue, 16 Mar 2010 14:37:44 -0700


On Mar 16, 2010, at 2:18 PM, Alejandro Rodriguez wrote:

[ob isEqual:@"hello"]; //returns YES
[@"hello" isEqual:ob]; //returns NO

That may very well be the problem... now... I have no idea on how I will make the second test return YES.

You can't do that in Objective-C, unfortunately. It would require splicing into NSString's implementation of -isEqual: and adding your own test before the existing one. (You could probably do it by messing with the runtime to replace the method, but that would be very nasty.)


This basically allows me to do something like [messageSet member:@"123"] and return the object with ID 123 or [memberSet member:messageObject] and have the same result.

It might be convenient to do that, but there isn't a clean way to implement it. You'll need to think of another way to do what you want to do. One possibility is to use an NSDictionary mapping identifiers to your objects.


—Jens_______________________________________________

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: 
 >Nil items in NSMutableSet (From: Alejandro Rodriguez <email@hidden>)
 >Re: Nil items in NSMutableSet (From: Clark Cox <email@hidden>)
 >Re: Nil items in NSMutableSet (From: Alejandro Rodriguez <email@hidden>)
 >Re: Nil items in NSMutableSet (From: Clark Cox <email@hidden>)
 >Re: Nil items in NSMutableSet (From: Thomas Davie <email@hidden>)
 >Re: Nil items in NSMutableSet (From: Clark Cox <email@hidden>)
 >Re: Nil items in NSMutableSet (From: Alejandro Rodriguez <email@hidden>)

  • Prev by Date: Re: Nil items in NSMutableSet
  • Next by Date: Re: Cocoa Newbie Thread/Memory Problems
  • Previous by thread: Re: Nil items in NSMutableSet
  • Next by thread: Re: Nil items in NSMutableSet
  • Index(es):
    • Date
    • Thread