views:

71

answers:

1

I have a NSArrayController bound to NSUserDefaultsController, and the array stores a custom class of mine, which conforms to NSCoding.

It seems like I need NSArchiver, but I can't quite figure out how to glue it all together

+1  A: 

You need a value transformer, which you can specify in the options of the binding. You can use NSKeyedUnarchiveFromData to serialize the array to keyed archive data, or make your own custom value transformer to convert the objects in the array to property lists of your own design.

Peter Hosey
This worked awesomely, I just got tripped up not realising that NSValueTransformer was expecting to deal with an array of objects, as opposed to the object directly.
aussiegeek
The value transformer must deal with whatever object is the value of the property, whether that object is a single object or an array object holding other objects.
Peter Hosey