Re: Value Transformer Name
Re: Value Transformer Name
- Subject: Re: Value Transformer Name
- From: Keary Suska <email@hidden>
- Date: Fri, 10 Apr 2009 09:07:31 -0600
On Apr 10, 2009, at 8:15 AM, Richard Somers wrote:
In an Xcode data model window, a transformable attribute has an
input labeled "Value Transformer Name:".
The Core Data Programming Guide says "By default, Core Data uses the
NSKeyedUnarchiveFromDataTransformerName transformer, however you can
specify your own transformer if you want."
In my test application various values for the "Value Transformer
Name:" in the data model window produce the following error warnings.
1. blank -[NSKeyedArchiver encodeValueOfObjCType:at:]: this
archiver cannot encode structs
2. NSKeyedUnarchiveFromDataTransformerName Warning: no
NSValueTransformer with class name
'NSKeyedUnarchiveFromDataTransformerName' was found
3. NSKeyedUnarchiveFromData -[NSConcreteValue bytes]:
unrecognized selector sent to instance
Questions
Why does number 2 not work when the documentation indicates that it
should and is actually the default condition?
NSKeyedUnarchiveFromDataTransformerName is not the name of the
transformer but the identifier for the constant string that contains
the transformer name. Your test #3 demonstrates this fact, so wouldn't
it be obvious?
If number 3 is really the same as the default condition then why
does it not produce the exact same results as number 1?
I would file a bug against the documentation for clarification. I
would hazard the guess that Core Data handles transformations
differently when you specify a transformer name and when you don't.
Hence the different errors.
Why does the NSValueTransformer class have named transformers but
those names can not be used in the Xcode data modeler or in
Interface Builder without producing an error?
This is not a true statement. It may be the fact that you cannot use
"NSKeyedUnarchiveFromDataTransformerName" as a specified name, but not
that you can't use *any* named transformer. If you want the
functionality of the default transformer, simply leave the transformer
name blank. Who cares otherwise?
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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