I have an NSMutableSet
set that contains custom made objects who are a subclass of SKNode
. I am making a game where these objects are added and removed from the NSMutableSet. I am adding and removing from the main thread, so threading isn't an issue. For some reason sometimes an object isn't removed because it can't be found. The following method returns NO
:
[self.set containsObject:object]
I looked into the this problem and printed the address and hash number of the object and all the objects in the NSMutableSet
, and sure enough it appears in the set.
What could be the reason that the object isn't found if the address and hash numbers equal? I understand that the containsObject
method uses the isEqual
which compares these two values.