Re: Archiving selection index paths with core data
Re: Archiving selection index paths with core data
- Subject: Re: Archiving selection index paths with core data
- From: mmalcolm crawford <email@hidden>
- Date: Fri, 10 Jun 2005 10:58:30 -0700
On Jun 10, 2005, at 7:29 AM, Ian G. Gillespie wrote:
I have a binary attribute in one of my core data entities called,
"selectionIndexPaths".
Just to be sure, do you mean that in your model you have defined an
attribute, "selectionIndexPaths", as a binary attribute? You would
probably be better to follow the strategy outlined for the
"workaround" below.
In IB I bound a tree controller with this key path to the selection
of an array which contains the entities. I also used the
NSUnarchiverFromData value transformer in IB. However, when ever I
save I get this message, "-encodeInt:forKey: only defined for
abstract class. Define -[NSArchiver encodeInt:forKey:]! " I am
not sure what this means, where do I need to define it? I thought
NSIndexPath conformed to the NSCoding protocol?
Oh, that's interesting. A test reveals that NSIndexPath fails with
NSArchiver, but succeeds with NSKeyedArchiver...
Rather than using the value transformer in IB, you should define a
transient attribute for the attribute, add a persistent attribute for
the data (e.g. selectionIndexPathsData), and incorporate the
transformation in your accessor method as outline in <http://
developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/
cdNSAttributes.html>
(You could implement and register your own KeyedArchiveFromData
transformer, but in general it's probably better to incorporate that
"business logic" into your model class and expose the attribute type
a user might expect.)
mmalc
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden