Re: Determining whether a dictionary is mutable or not
Re: Determining whether a dictionary is mutable or not
- Subject: Re: Determining whether a dictionary is mutable or not
- From: "email@hidden" <email@hidden>
- Date: Fri, 14 Jan 2011 11:28:21 +0000
On 14 Jan 2011, at 10:48, Tito Ciuro wrote:
> Hello,
>
> Trying to determine whether an NSDictionary is mutable or not fails with these two tests:
>
> // Variable info could be NSDictionary or NSMutableDictionary. Assume it's an NSDictionary.
>
> BOOL isKindOfClass = [info isKindOfClass:[NSMutableDictionary class]];
> BOOL respondsToSelector = [info respondsToSelector:@selector(setObject:forKey:)];
>
> After executing the above statements, both variables 'isKindOfClass' and'respondsToSelector' are set to YES.
>
> When I obtain the class type of 'info', I get:
>
> (gdb) po [info class]
> NSCFDictionary
>
> The question is: if 'info' is an immutable dictionary, why is isKindOfClass and respondsToSelector telling me that it is mutable?
>
The following thread discusses the above and the logic that causes it to be so:
http://lists.apple.com/archives/cocoa-dev/2008/Dec/msg00649.html
Regards
Jonathan Mitchell
Developer
Mugginsoft LLP
http://www.mugginsoft.com
_______________________________________________
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