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

problem using User Defaults bindings for sample data


  • Subject: problem using User Defaults bindings for sample data
  • From: David Feldman <email@hidden>
  • Date: Fri, 17 Sep 2004 12:30:03 -0400

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?

Thanks,
--Dave

_______________________________________________
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: problem using User Defaults bindings for sample data
      • From: Scott Stevenson <email@hidden>
    • Re: problem using User Defaults bindings for sample data
      • From: mmalcolm crawford <email@hidden>
    • Re: problem using User Defaults bindings for sample data
      • From: Ondra Cada <email@hidden>
    • Re: problem using User Defaults bindings for sample data
      • From: Frederick Cheung <email@hidden>
  • Prev by Date: Re: Couple more binding questions
  • Next by Date: Re: [Q] Bindings, FilteringController and KVC compliance
  • Previous by thread: Re: NSUIElement and LaunchServices
  • Next by thread: Re: problem using User Defaults bindings for sample data
  • Index(es):
    • Date
    • Thread