I can set UIColor objects as keys in an NSMutableDictionary all day long and everything is fine and happy...
For instance:
[myDict setObject:foo forKey:[UIColor redColor]];
That works just fine... UNLESS I try to use the following:
UIColor *black = [[UIColor alloc] initWithRed:0 green:0 blue:0 alpha:1];
[myDict setObject:foo forKey:black];
That always gives me:
-[UIDeviceRGBColor copyWithZone:]: unrecognized selector sent to instance 0x691be80
The reasons for why I'm defining black in the RGB colorspace are unimportant to this question, just know that I must define it that way. What I don't understand is why is this and only this color causing me a problem, and why is it that the error is a copyWithZone error?
For the record, [UIColor blackColor] works as a key, but because it isn't an RGB colorspace it is not suitable for my application.