Because NSDictionary requires keys to be copyable because it copies them
(it's in the documentation). Use a CFDictionary() instead, you can set
it up to retain the keys and do what you want.
Rick Mann wrote:
I'd like to use a CALayer object as a key in a dictionary. The reason is that
when my app detects a hit in a layer, I need to quickly determine which object
I've associated with it. Since I can't store a reference to an arbitrary object
in the CALayer, a dictionary seems to be the most expedient way to do that.
Unfortunately, I can't seem to add my layer as the key (it fails with "-[CALayer
copyWithZone:]: unrecognized selector sent to instance 0x50132a0"). It's really
pretty handy to be able to use any object as a key, why is this not the case in Obj-C?
TIA,
Rick
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org
This email sent to r...@rols.org
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com