In my model, I have an attribute transformingString
that stores an NSString object as NSData, using the "Transformable" type. In my code, I have an NSString as an dynamic property in my NSManagedObject, and accessing that property automatically invokes the value transformer to convert from NSData to NSString.
In some cases, though, I want to access the raw NSData in my code, without invoking the NSValueTransformer, so I can handle the NSData in a different way for some edge case. How can I do this? I don't think there is any way to just turn off the Transformable type for my Core Data model. I'm hoping there is some way to access the raw NSData directly that is passed into the transformer.
I've tried [self primitiveValueForKey: @"transformingString"]
but that also invoked the NSValueTransformer and returns the NSString type. Is there a way to do this?
If i resume you want access a value on a NSManagedObject that is not stored in persistent Store. I suggest you to add a category on your NSManagedObject. In this category declare a property in readonly (for be sure that not use for an other thing). In the implementation return the raw NSData.