(CoreData) Saving Predicates in SmartGroups
(CoreData) Saving Predicates in SmartGroups
- Subject: (CoreData) Saving Predicates in SmartGroups
- From: Chris Blunt <email@hidden>
- Date: Tue, 19 Sep 2006 14:51:35 +0100
Hi,
I have two entity-types: Person and Record. I also have an entity
SmartGroup which contains a predicateData (Binary) attribute, as
given in the CoreRecipes sample app.
For simple predicates, such as "Person.name='chris'", this setup
seems to work OK. However, I would like to be able to add SmartGroups
that fetch 'All records belonging to {a Person}', so the SmartGroup
becomes an abstract representation of a Person. By attempting to
create the SmartGroup using a predicate such as:
...
[fetchRequest setEntity:recordEntity];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"owner == %
@", personEntity];
...
NSData *predicateData = [NSArchiver
archivedDataWithRootObject:predicate];
...
the NSarchiver attempts to encodeWithCoder: the NSManagedObject that
is being referenced (in this case, personEntity). Whilst I can see
from documentation that Core Data objects can be encoded in this way,
something tells me this isn't right way to go about doing this, as it
would potentially mean encoding a lot of the object graph into the
predicateData.
Is there a better way of making SmartGroups that reference other
entity instances in the object graph?
Thanks!
Chris
--
www.chrisblunt.com
_______________________________________________
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