Re: Determining if NSArray/NSDictionary is immutable
Re: Determining if NSArray/NSDictionary is immutable
- Subject: Re: Determining if NSArray/NSDictionary is immutable
- From: Ken Tozier <email@hidden>
- Date: Sat, 9 Jul 2005 00:43:58 -0400
On Jul 9, 2005, at 12:20 AM, Scott Anguish wrote:
could you not just test for one of the required primitives for the
mutable version?
addObject:
insertObject:atIndex:
removeLastObject
removeObjectAtIndex:
replaceObjectAtIndex:withObject:
if it responds to the selector, then you'd be mutable.
I was thinking that too but it doesn't work. Immutable dictionaries
return true for all of them.
id mTest = [NSDictionary dictionary];
if ([mTest respondsToSelector: @selector(removeAllObjects)])
NSLog(@"mTest is mutable");
else
NSLog(@"mTest is immutable");
Always returns "mTest is mutable" regardless if it's mutable or
immutable
Ken
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden