• 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
Determining whether a dictionary is mutable or not
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Determining whether a dictionary is mutable or not


  • Subject: Determining whether a dictionary is mutable or not
  • From: Tito Ciuro <email@hidden>
  • Date: Fri, 14 Jan 2011 11:48:43 +0100

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?

Thanks,

-- 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

  • Follow-Ups:
    • Re: Determining whether a dictionary is mutable or not
      • From: Pablo Pons Bordes <email@hidden>
    • Re: Determining whether a dictionary is mutable or not
      • From: "email@hidden" <email@hidden>
    • Re: Determining whether a dictionary is mutable or not
      • From: Mike Abdullah <email@hidden>
  • Prev by Date: Mutable to-many relationship not observable
  • Next by Date: Re: Mutable to-many relationship not observable
  • Previous by thread: Re: Mutable to-many relationship not observable
  • Next by thread: Re: Determining whether a dictionary is mutable or not
  • Index(es):
    • Date
    • Thread