cocoa - iPhone Core Data: Do Transformable Attributes have to Transform to only Data? -
I took ...
The idea behind the convertible features is that you access an attribute as a non-standard type, but the core data behind the scenarios is one of the NSValueTransformer To use the example, to change the attribute and an example of NSDT, core data then stores the data instance in the store continuously.
... This means that you can only convert things into data and other types of attributes like string
It just happened to me that this matter may not be the case, the documentation will only be talking about the most common case. In the IIRC, cocoa binding, conversions can be largely arbitrary. To change the NSSRIRL for performance, say, it is possible to do NSSRR and then reverse it.
Before I wasted time to experiment and possibly getting a misleading result, I was surprised if someone knows that the transformations are from data and only data.
Correct you have to change your property in the NSData object You must serialize
NSURL
to NSData and default
NSKeyedUnarchiveFromDataTransformerName
transformer will do this for you.
Another approach, and which I use for URL, is to maintain two parallel properties. I am a transient property of the undetermined type for the URL, and the second continuous property of string type for the backing store . I freely requested the creation of the URL from the string for the first time, and whenever I change the URL, I update the string property.
There is no way to implement this, but you do not really want to use it in your organization's string property outside of the class, I usually use @property
Do it myself not to use it to remind me personally of definition.
Comments
Post a Comment