• 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: Bug in NSArrayController? (immutable instead of mutable dictionaries)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in NSArrayController? (immutable instead of mutable dictionaries)


  • Subject: Re: Bug in NSArrayController? (immutable instead of mutable dictionaries)
  • From: Uli Zappe <email@hidden>
  • Date: Fri, 22 Oct 2004 02:59:10 +0200

OK, just for the archive:

Am 22.10.2004 um 01:17 schrieb Uli Zappe:

NSUserDefaultsController has an extremely strange behavior in a specific case, which I can only think of as bug, not as feature:

The behavior of NSUserDefaultsController is even weirder.

Given an NSArrayController (with NSMutableDictionary as its Objects Class) that's bound to a shared NSUserDefaultsController, the following applies (to make it more readable, I will neglect the array object that is send as the container of the dictionary object):

1. If NSUserDefaultsController, at application startup, reads a preferences plist with an array with an *empty* dictionary, it will send an *immutable* dictionary to NSArrayController.

2. If NSUserDefaultsController, at application startup, reads a preferences plist with an array with a *non-empty* dictionary, it will send a *mutable* dictionary to NSArrayController.

3. If a new dictionary is created via NSArrayController (via insert: or any other method, as long as it triggers Binding), NSArrayController sends the new *mutable* dictionary to NSUserDefaultsController. NSUserDefaultsController sends it back immediately as an *immutable* dictionary. As a result, NSArrayController always ends up with an immutable dictionary.

4. The above only happens as long as appliesImmediately is set to YES in NSUserDefaultsController. If it is set to NO, NSUserDefaultsController always returns mutable dictionaries. However, this is no workaround for the creation of new mutable dictionaries, because as soon as as appliesImmediately is set back to YES to enable saving the preference settings to disk, NSUserDefaultsController sends an *immutable* dictionary to NSArrayController, thus changing the mutable to an immutable dictionary.

I'll file a bug report.

Bye
Uli
________________________________________________________

Uli Zappe, Solmsstraße 5, D-65189 Wiesbaden, Germany
http://www.ritual.org
Fon: +49-700-ULIZAPPE
Fax: +49-700-ZAPPEFAX
________________________________________________________

_______________________________________________
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
  • Follow-Ups:
    • Re: Bug in NSArrayController? (immutable instead of mutable dictionaries)
      • From: "M. Uli Kusterer" <email@hidden>
References: 
 >Bug in NSArrayController? (immutable instead of mutable dictionaries) (From: Uli Zappe <email@hidden>)
 >Re: Bug in NSArrayController? (immutable instead of mutable dictionaries) (From: Brent Gulanowski <email@hidden>)
 >Re: Bug in NSArrayController? (immutable instead of mutable dictionaries) (From: Uli Zappe <email@hidden>)
 >Re: Bug in NSArrayController? (immutable instead of mutable dictionaries) (From: Uli Zappe <email@hidden>)

  • Prev by Date: Re: Toolbar Item Validation in a Panel
  • Next by Date: Re: mainmenu in nib file
  • Previous by thread: Re: Bug in NSArrayController? (immutable instead of mutable dictionaries)
  • Next by thread: Re: Bug in NSArrayController? (immutable instead of mutable dictionaries)
  • Index(es):
    • Date
    • Thread