Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing/Export core data database from one device to another

I'm trying to create an app which will store data locally using coredata. Then I want to share/export that data(from coredata) to be used by other devices using same app.

Is it possible to send a coredata from one device to another? Can I just copy the *.sqlite file and overwrite the coredata in the other device?

I saw this post how to export Core Data to CSV that allow core data to be exported as csv, But what I'm trying to achieve is to pass core data itself.

Thank You!

like image 288
Encio Peter Avatar asked Sep 13 '25 17:09

Encio Peter


1 Answers

You can use migratePersistentStore:toURL:options:withType:error: of NSPersistentStoreCoordinator to save the store to a file. Once you have the file you can copy it to the other devices.

Other solutions might include iCloud if you're wanting data synchronisation.

like image 192
Joony Avatar answered Sep 16 '25 06:09

Joony