Re: Value Transformer Name
Re: Value Transformer Name
- Subject: Re: Value Transformer Name
- From: Quincey Morris <email@hidden>
- Date: Fri, 10 Apr 2009 11:56:07 -0700
On Apr 10, 2009, at 11:27, Richard Somers wrote:
On Apr 10, 2009, at 11:54AM, Quincey Morris wrote:
Core Data runs a custom transformer in the forward direction, but
it runs the default transformer in the reverse direction.
The documentation states "Core Data uses an instance of
NSValueTransformer to convert the attribute to and from an instance
of NSData. By default, Core Data uses the
NSKeyedUnarchiveFromDataTransformerName transformer."
So a single instance of NSValueTransformer is used in both
directions and the default is an instance of
NSKeyedUnarchiveFromDataTransformerName transformer.
OK, one more try before I give up.
What I actually said was:
To archive the value of a transformable attribute (i.e. to create
its NSData representation), Core Data runs a custom transformer in
the forward direction, but it runs the default transformer in the
reverse direction.
The first part of that was important. Of course Core Data runs the
transformers in different directions at different times. It runs:
NSKeyedUnarchiveFromData in reverse, to get a NSData from an attribute
NSKeyedUnarchiveFromData forward, to get an attribute from a NSData
a custom transformer forward, to get a NSData from an attribute
a custom transformer in reverse, to get an attribute from a NSData
Therefore, specifying NSKeyedUnarchiveFromData as a custom transformer
doesn't work. Compare line #1 with line #3, or line #2 with line #4 to
see why it fails.
And, again, your testing already demonstrated that it fails.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden