I need to export a few entities with its relationships in order to import it in other iOS device. For example:
A.relationship1 <------>> B.relationship1 (one to many)
B.relationship2 <-------> C.relationship1 (one to one)
Is there a way to serialize/deserialize (or other methods) to export/import "easily" a fragment of the core data model (objects and its relationships fetched by a fetched results controller? By serializing all the data pack (NSData or something), deserializing and inserting it to the context (importing).
Please point me in the right direction. Thanks in advance.
The best way for you, i think,is convert your Core Data objects to JSON,save it,and then decode it back.
Here is absoluetley great working code of both encoding and decoding by Marcus Zarra
JSON and Core Data on the iPhone
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With