• 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
Cocoa Bindings + User Defaults Controller Trouble
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cocoa Bindings + User Defaults Controller Trouble


  • Subject: Cocoa Bindings + User Defaults Controller Trouble
  • From: Denis Defreyne <email@hidden>
  • Date: Wed, 18 May 2005 22:19:08 +0200

Hello list.

Having some trouble with Cocoa Bindings combined with user defaults.

I have an array controller whose contentArray is bound to the Shared User Defaults. I use my immutable-to-mutable value transformer because NSUserDefaultsController's collections are immutable (at least in Panther).

When the Object Class Name is set to NSMutableDictionary, everything works; the contents of the array is written to the preferences plist. So far so good.

However, when I change the Object Class Name to my own tiny class, ALFavourite, I'm getting the following error when -add: is called:

*** -[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value '<CFArray 0x9d16950 [0xa01c00e0]>{type = mutable-small, count = 2, values = (
0 : <CFDictionary 0x373230 [0xa01c00e0]>{type = mutable, count = 0, capacity = 4, pairs = (
)}
1 : <ALFavourite: 0x9d16930>
)}' of class 'NSCFArray'.


I'm not sure what is going on here and how to fix it. My guess is that since ALFavourite is a custom class, NSUserDefaultsController doesn't know how to store that into the plist, which probably means that I need some kind of value transformer to encode the ALFavourite instances.

I've tried messing around, to no avail. What am I overlooking?

Regards,

amon-re

--
mail: email@hidden
web: http://www.amonre.org/

_______________________________________________
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: Cocoa Bindings + User Defaults Controller Trouble
      • From: Ondra Cada <email@hidden>
    • Re: Cocoa Bindings + User Defaults Controller Trouble
      • From: Chris Parker <email@hidden>
  • Prev by Date: Re: HTTP server with NetSocket
  • Next by Date: sample code for connecting to server
  • Previous by thread: Beware abs function in Core Data
  • Next by thread: Re: Cocoa Bindings + User Defaults Controller Trouble
  • Index(es):
    • Date
    • Thread