On Feb 22, 2009, at 11:17 AM, Michael Domino wrote:

I have a situation where I'm writing a preferences file and I have a major section and one or more minor sections, like this:

Settings
        Logging
        Initialization

Everything actually works fine, except that I get this error when writing a minor section:

2009-02-22 10:10:56.466 Identity Finder[40754:813] CFDictionarySetValue(): immutable collection 0x11ad8f0 given to mutating function

[...]

The question is: does CFDictionaryGetValueIfPresent always return an immutable object

No.  It returns the value that's in the dictionary.

and is there another api call that will return a mutable dictionary? Am I doing this the wrong way?

The problem isn't in how you're getting stuff out of your dictionary, it's how the dictionary is created and filled. I suspect you're using the CFPropertyList or CFPreferences APIs, which by default give you immutable object graphs.

By the way, none of this is Cocoa-specific. Perhaps Cocoa-Dev isn't the best list for this.

Regards,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to