简体   繁体   中英

iCloud sync with app using sqlite database - IOS

I am building universal app.In my app I am using sq-lite database.I want to sync my local data with iCloud so any other user who install app in iPhone can sync the data to his phone/Ipad.

I did search related to this on many places where I found iCloud sync with code-data but I am using sq-lite.

Is their any way to perform this action.

Thanks in Advance.

Your best bet is to implement Core Data to be able to sync with iCloud. From my research, there is no convenient way of syncing a SQLite database with iCloud without using Core Data. The advantages gained by using it go beyond accessing data. Implementing Core Data can help you work with your data more effectively because it provides a mature framework for object-relational mapping. It does have limitations such as how schema changes make existing stores inaccessible. However, it also excels in areas like support for object persistence. Overall, it can only help you to be able to use it especially with regard to synchronizing with iCloud.

There are different ways to begin converting your database to Core Data. One approach is to manually modify the SQLite database generated by Core Data once you have a model. You can determine what to change by looking at the generated database in /AppData/Documents available through the Organizer in Xcode. From there it can be a simple matter of copying your SQLite data to the new database. While this method is not recommended by Apple because they may change the Core Data schema, it can provide a means of readily migrating existing data sets. Another way is to write code to translate between the data stores within your app. You could even simultaneously maintain both implementations, SQLite and Core Data, if you wanted to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM