• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Determining if NSArray/NSDictionary is immutable
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Determining if NSArray/NSDictionary is immutable (From: email@hidden)
 >Re: Determining if NSArray/NSDictionary is immutable (From: Scott Anguish <email@hidden>)

  • Prev by Date: Re: Documentation frustrations
  • Next by Date: Getting all managed objects of given entity
  • Previous by thread: Re: Determining if NSArray/NSDictionary is immutable
  • Next by thread: Re: Determining if NSArray/NSDictionary is immutable
  • Index(es):
    • Date
    • Thread