• 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: problem using User Defaults bindings for sample data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem using User Defaults bindings for sample data


  • Subject: Re: problem using User Defaults bindings for sample data
  • From: Frederick Cheung <email@hidden>
  • Date: Fri, 17 Sep 2004 18:48:52 +0200


On 17 Sep 2004, at 18:30, David Feldman wrote:

As mentioned in an earlier message, I'm looking to use Cocoa Bindings to simplify the task of creating sample data for app prototypes. The tutorials recommended here were excellent but I'm having trouble adapting them. What I want to do is use the Shared Defaults Controller to handle the sample data, presumably speeding things up and allowing me to edit the plist file to change the data. But I'm having some issues. Here's what I've done, starting with a Cocoa Application template project:

(1) Created an NSArrayController (named it TableController). Bound its contentArray to Shared User Defaults with Controller Key values and Model Key Path tableData.
(2) Dragged a NSTableView into the default window. Left it with two columns (labeled Left and Right). Bound its Left column's value to TableController, Controller Key arrangedObjects, Model Key Path "left". Did the same for the Right column with Model Key Path "right".
(3) Dragged a button into the default window. Control-dragged from it to TableController and selected the add: action.


I've left everything else as is. What happens is that the Add button works just fine and adds a blank row. I can then put a cell into edit mode and type some text, but when I try to finish editing I get an error in the Run Log: "[NSCFDictionary setObject:forKey:]: mutating method sent to immutable object" A look at the plist file in ~/Preferences reveals that while a Dictionary item has been added to the array, no key/value items have been added to that dictionary. If I manually add items with "left" and "right" keys they show up in the app as they should but still can't be edited. Any thoughts?

The objects you get back from user defaults are immutable, hence the error message.

Fred

_______________________________________________
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: 
 >problem using User Defaults bindings for sample data (From: David Feldman <email@hidden>)

  • Prev by Date: DO - Multiple thread access to root proxy needs protocol set?
  • Next by Date: Re: problem using User Defaults bindings for sample data
  • Previous by thread: problem using User Defaults bindings for sample data
  • Next by thread: Re: problem using User Defaults bindings for sample data
  • Index(es):
    • Date
    • Thread