Reputation: 17329
I'm using Core Data in my app and would like to export only some of the data and import it on some other device.
To avoid migration issues, I'd like to do the following:
Export:
Import: - copy export.sqlite-file into app - add that .sqlite-file with addPersistentStoreWithType - copy data over - remove added persistentStore
but how to achieve that? i.e. how can I tell my managed object so copy itself into the other store?
Upvotes: 3
Views: 1777
Reputation: 70936
how can I tell my managed object so copy itself into the other store?
You can't, not directly anyway. You'll have to do something like:
The relationships need to be done separately, because all of the objects in a relationship need to exist before you can create the relationship.
Upvotes: 3