How can I duplicate, or copy a Core Data Managed Object?
Posted
by 106480833665852483906
on Stack Overflow
See other posts from Stack Overflow
or by 106480833665852483906
Published on 2010-04-28T15:22:57Z
Indexed on
2010/04/28
15:53 UTC
Read the original article
Hit count: 146
I have a managed object ("A") that contains various attributes and types of relationships, and its relationships also have their own attributes & relationships. What I would like to do is to "copy" or "duplicate" the entire object graph rooted at object "A", and thus creating a new object "B" that is very similar to "A".
To be more specific, none of the relationships contained by "B" (or its children) should point to objects related to "A". There should be an entirely new object graph with similar relationships intact, and all objects having the same attributes, but of course different id's.
There is the obvious manual way to do this, but I was hoping to learn of a simpler means of doing so which was not totally apparent from the Core Data documentation.
TIA!
© Stack Overflow or respective owner