开发者

How can I enable iCloud synchronization for my Core Data database?

开发者 https://www.devze.com 2023-04-13 06:16 出处:网络
I want to make my app sync its SQLite Core Data store between devices using iCloud. Right now I let users manua开发者_JAVA百科lly sync their SQLite files using Dropbox, but that is cumbersome for user

I want to make my app sync its SQLite Core Data store between devices using iCloud. Right now I let users manua开发者_JAVA百科lly sync their SQLite files using Dropbox, but that is cumbersome for users. I want it to be automatic.

What is the best practice to achieve this functionality? Do I need any special provisioning profiles?

I read somewhere that I need to set up my Core Data database to use UIManagedDocument but I haven't found anywhere that explains how to do this clearly. Any suggestions?


Turn on cloud syncing. That is step one. From there it depends on your application and its requirements.

Sorry for the short answer but your question is rather vague and you do not have any requirements for your app.

Assuming it is just a sqlite file all you need to do is turn on cloud syncing, change your Core Data stack to handle being async and Bob's your uncle.

Update

It is unlikely you will need to use UIManagedDocument. I would say that unless you have a kitchen sync type application you are fine using the Core Data ubiqutous store syncing at the NSPersistentStore level.

At this time, quite a few people are having issues with UIManagedDocument so I would avoid it unless you absolutely need to sync things that are not contained within the sqlite file.

0

精彩评论

暂无评论...
验证码 换一张
取 消