Re: Managed Object with Transformable Attribute (C Struct)
Re: Managed Object with Transformable Attribute (C Struct)
- Subject: Re: Managed Object with Transformable Attribute (C Struct)
- From: "Melissa J. Turner" <email@hidden>
- Date: Wed, 16 Dec 2009 15:39:28 -0800
On Dec 15, 2009, at 20:47, Richard Somers wrote:
> On Dec 15, 2009, at 9:18 PM, Graham Cox wrote:
>
>> You're archiving 'value'. You want instead to return the mutableData that the first archiver wrote to, which is otherwise unused.
>
> Thanks. Saving keyed archive of struct foo now works for xml store (I think, when I open up the xml document I was expecting to see the keys for foo but instead just see data as before).
>
> Prior to this change document saved ok in xml and sqlite but save as binary resulted in error: *** -[NSKeyedArchiver encodeValueOfObjCType:at:]: this archiver cannot encode structs.
>
> With this change saving to xml is ok but saving as sqlite or binary results in error: The document could not be saved as "document".foo is a required value.
>
> My whole application works fine with core data, bindings, saving to different store types, etc. Just this one attribute is causing problems.
>
> Any ideas?
>
I think you're running into a known problem with the binary store not respecting the value transformer name and instead always using the default archiver (NSKeyedArchiver).
The only real workaround is to have a wrapper property (ie a property returning an NSData) that does the transform and persist that instead.
+Melissa
_______________________________________________
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