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: Tito Ciuro <email@hidden>
- Date: Fri, 14 Jan 2011 12:41:04 +0100
Hi Jonathan,
On Jan 14, 2011, at 12:34 PM, email@hidden wrote:
> On 14 Jan 2011, at 11:25, Tito Ciuro wrote:
>
>> Hi Mike,
>>
>> Given that the caller can pass a NSDictionary or an NSMutableDictionary, I wanted to test its mutability before calling setObject:forKey:. In order to avoid calling mutableCopy each time, I thought it would be more efficient to test it and then call mutableCopy only when needed.
>>
>> Thanks for the help,
>>
>> -- Tito
>>
>>
>
>
> In this case just check if your object responds to setObject:forKey:
> If it does its mutable, if not it isn't.
But that's the problem: it always returns YES, even when it's an immutable dictionary.
-- Tito
_______________________________________________
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