• 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
User Default Bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

User Default Bindings


  • Subject: User Default Bindings
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Fri, 19 Dec 2008 13:21:18 +0700


I have User Defaults (Preferences) like:

MainDict =
{
	Peter = { Income = 20, Age = 77 },
	Nancy = { Income = 24, Age = 37 }
}

That is, the preferences contain a dictionary (MainDict) which contains two sub-dictionaries (Peter and Nancy).

When in IB I bind an NSTextField to:
Shared Defaults
Controller Key: values
Model Key Path: MainDict.Peter.Age

and set the text field to 88, my preferences will contain a new entry:
MainDict.Peter.Age = 88
but the MainDict remains unchanged.

And when I do programmatically:
NSUserDefaultsController *s = [ NSUserDefaultsController sharedUserDefaultsController ];
[[s values] setValue: [ NSNumber numberWithInt: 88 ] forKeyPath: @"MainDict.Peter.Age" ];
I get an exception:
...[<NSUserDefaultsController 0x13c230> valueForUndefinedKey:]: this class is not key value coding-compliant for the key MainDict.


So, obviously, I have some fundamental misunderstandings.

A related question: In Tiger I often used a Model Key Path containing blanks. Now IB (Version 3.1.1 (672)) does no longer allows me to enter this.
Where is the definition of a valid key path to be found?



Kind regards,

Gerriet.


_______________________________________________

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


  • Prev by Date: Re: NSData downloaded over socket is bigger than it should be...
  • Next by Date: Re: Error with malloc and NSFileWrapper
  • Previous by thread: Re: download security hanging app
  • Next by thread: Re: User Default Bindings
  • Index(es):
    • Date
    • Thread