How to share Core Data between multiple users?

人走茶凉 提交于 2019-12-24 11:54:18

问题


I am trying to build a simple shared database app for iOS (specifically iPhone for now). The app would let multiple unrelated users on multiple devices add entries to and remove entries from a shared Core Data database that would be searchable by all users. (Ideal product)

I've been searching a lot about iCloud + Core Data but have mostly come across angry rants about how much it sucks. I've looked into Parse but got stuck when trying to use AFNetworking(?). Others have told me to use Amazon Web Services, or to create a simple PHP website to which my app sends its data, or to use carrier pigeons with USB sticks, etc. Somewhere in the rabbit hole I got stuck when trying to use Cocoapods to manage my libraries. Basically, I've been told to do a lot of different things and need to pick one.

I guess a more specific question would be: Do you think Apple's changes to Core Data + iCloud integration this year (WWDC 2013) mean I should try their approach? Or do they suck sufficiently enough that I should try something else?

I saw this previous post, but it seems(?) like its answer is about how to share data between apps rather than between users on different devices: share core data between many users on app

Basically I have no idea what I'm doing and wish I could ask a better question.


回答1:


If you want to share data between multiple users, you need some kind of online service you can use to store the data. That's all there is to it. It could be a service that provides its own API (like Parse) or one that you roll your own (PHP or whatever server side tech you prefer). Writing your own is not a job for the inexperienced; if you were in a position to create one, you'd already know what to do.

Sharing between different users is not a problem that iCloud was created to solve. I don't know Apple's roadmap, but this option is not there now and I don't think it's likely to appear anytime soon. Using iCloud is orthogonal to the sharing you want-- it might be useful to you for some things, but not for this.




回答2:


I think your best solution is to create a web service (php) with all the required functions (getFromDB, addToDB, removeFromDB,...) and you can use the app to send data and get data from the web service. Hope this helps... Good luck!



来源:https://stackoverflow.com/questions/17178031/how-to-share-core-data-between-multiple-users

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!