Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8797453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:51:38+00:00 2026-06-13T23:51:38+00:00

Apple’s docs currently DO NOT DOCUMENT NSSet’s concept of identity. I have some bugs

  • 0

Apple’s docs currently DO NOT DOCUMENT NSSet’s concept of “identity”.

I have some bugs that appear to come from Apple’s code. For instance, “[NSMutableSet minusSet]” never works for me as documented – but I’m pretty sure it’s because of “identity”.

e.g. from: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSSet_Class/Reference/Reference.html#//apple_ref/occ/cl/NSSet

containsObject:

Returns a Boolean value that indicates whether a given object is
present in the set.

YES if anObject is present in the set, otherwise NO.

What does that MEAN?

FYI things I’ve tried:

  1. implemented “isEqual:” on all classes in the set
  2. checked that all classes are the same class (no subclass / superclass confusion)
  3. implementd NSCopying on all classes in the set (no effect)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:51:39+00:00Added an answer on June 13, 2026 at 11:51 pm

    In Cocoa, object equality is done by using isEqual: and hash:

    https://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html

    From the notes for isEqual::

    If two objects are equal, they must have the same hash value. This last point is particularly important if you define isEqual: in a subclass and intend to put instances of that subclass into a collection. Make sure you also define hash in your subclass.

    Your subclasses will need to implement both of these, so that they return the same thing. Once they do this, then they can be used correctly in Cocoa Collections.

    The reason your NSSet equality wouldn’t work, is because sets use hashes (it’s stored as a hash table), hence if you only implemented isEqual:, then theres a chance (a good chance) that their hashes would be different.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Apple developer document has the QTKit examples. I have noticed that it is only
Apple clearly has this automated in some way, I would like to have access
Apple's multithreading docs don't list NSIndexPath as threadsafe or not! As an immutable class,
Apple Http Live Streaming Overview document clearly states that streaming videos exceeding 10 minutes
Apple seems to say that this image should have no extension. But how is
Apple says, that in Cocoa -dealloc will not be called neccessarily when the application
Apple has many big colored buttons, that are not standard. One of them is
Apple does say in the documentation about the fact that they do not want
Apple have long blocked mobile Safari from playing sounds – the usual JavaScript commands
Apple's documentation for UIDocumentInteractionController presentOpenInMenuFromBarButtonItem:animated: method states that If there are no registered apps

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.