Copying Core Data relationships
Copying Core Data relationships
- Subject: Copying Core Data relationships
- From: Matteo Manferdini <email@hidden>
- Date: Fri, 7 Jul 2006 19:22:32 +0200
Hi, I have problems copyng core data relationships from an object to
another.
I have an abstract entity in my model with a to-many relationship in
it. Then I have two non-abstract entities that inherit from the
abstract one, one of the two used to save copies of instances of the
other entity. Let's say that object O is an instance of one of
the"original" entity and object C is an instance of the "Copy" entity.
When I copy single attributes from O to C everything works fine, but
when I copy the relationship, the references move from object O to
object C, leaving O relationship empty.
The behaviour I want to achieve is to copy the references, not moving
them. The problem arises if i use KVC as this:
[copy setValue:[original valueForKey:@"relationship"]
forKey:@"relationship"]
but it arises even if I traverse the relationship of the original
object with an enumerator and copy each item singularly, like this:
while (obj = [enumerator nextObject])
[copyRelationship addObject:obj];
Why is this happening?
Thank you everyone.
Cheers.
---
Matteo Manferdini
_______________________________________________
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