The "data" binding is deprecated in Mac OS X versions 10.6 a


The CarLot Application uses a data binding for the photo Property, but this binding is deprecated in OS X 10.6.

Through google I’ve find this solution that explained that I need a value transformer ( And gives the code for a custom value transformer.

But in the documentation I’ve found a better solution, that uses no code.

So, I’ve configured the binding as value instead of data and then I’ve used one of the Available Value Transformers:

* NSUnarchiveFromDataTransformerName:
The NSUnarchiveFromDataTransformerName transformer returns an object created by attempting to unarchive the data in the NSData object passed as the value. The reverse transformation returns an NSData instance created by archiving the value.
An object must implement the NSCoding protocol using sequential archiving in order to be unarchived and archived with this transformer.

The last note is satisfied because NSImage implements NSCoding protocol.

So, this is my solution (is it better the other one? I think so).
But this leave me a question, where can I find info on why something is deprecated in cocoa? In this particular case the data seemed something useful, so why is now deprecated?

Best regards


Don’t you have to implement NSUnarchiveFromDataTransformerName:?


Nope, it’s already defined.



Apparently, the NSUnarchiveFromDataTransformerName is just a pointer to an NSString (@“NSUnarchiveFromData”). Interface Builder uses the actual string, not the pointer. It should already be available in the Value Transformer drop-down window. There is no documentation that I could find from Apple to confirm this, but independent sources seem to indicate that all of the NS**********TransformerName constants are pointers to strings that are the same, minus the “TransformerName” suffix.

Hope this helps,



You can use Value binding and change the attribute of “photo” to Transformable. It appears to work without further tweeks.


I thought I’d add a point of clarification to this thread since I tore my hair out for a while trying to find
the “Transformable” attribute of photo (being an XCode newbie :slight_smile: )

“Transformable” is a value in the “Type” pull-down for the photo entity in the data model (MyDocument.xcdatamodel).

Hope this will save someone some time.