2

I would like to sync a core data app with a user with a different iCloud ID and I am trying to figure out the most graceful way to do this. I do not want the data to sync with all users, but want to be able to sync among family members for instance. From the research I have done, I do not think I can do that using iCloud Core Data sync because it only syncs between devices with the same iCloud ID. I have looked at this stackoverflow answer and read a little bit about Ensembles, Parcelkit and TICoreDataSync, Parse etc., but it is not clear to me if any of those options will allow me to sync with multiple users. Does anyone have a good method for syncing a Core Data app with multiple users?

Community
  • 1
  • 1
David L
  • 4,347
  • 3
  • 18
  • 30

3 Answers3

1

Ensembles and TiCoreDataSync might work. They can use Dropbox file syncing, so in principle they should work with Dropbox shared folders. I don't think these are the main intended uses, so I suggest contacting the developers and/or doing some good testing yourself before assuming this would actually work.

You'll need to think about the user experience, though. At a minimum, your users would both need Dropbox accounts and would have to set up a shared folder before beginning to sync data this way.

Parcelkit probably won't work. It uses Dropbox's data store API which, unlike other Dropbox services, doesn't appear to support shared data.

Services that do support this kind of sharing exist-- for example, Parse and Firebase-- but make sure to review their pricing carefully before using them. Also of course, there have been any number of projects that have their own custom server back end, but that obviously requires having someone on the team who can do that kind of work.

Tom Harrington
  • 69,312
  • 10
  • 146
  • 170
  • Thanks for the information, I may check on all those options further. For Parse, I have done some investigation and it looks like anything I do there would require me to add additional code and overhead to upload data to Parse with with Parse field names etc. Is there any other option you are aware of with Parse that more automatically manages the core data entities on the Parse end? – David L Jan 09 '15 at 19:07
  • Right, Parse is a generic back end, but making it work with Core Data is up to you. There's an open source framework called [FTASync](https://github.com/itsniper/FTASync), but I haven't tried it. – Tom Harrington Jan 09 '15 at 19:16
  • Thanks, I'll check all these out. – David L Jan 09 '15 at 22:14
  • I am thinking about developing my own library to solve this very problem. See http://stackoverflow.com/questions/31283529/core-data-sync-via-parse. I would love to get feedback on my approach. – ChemDev Jul 08 '15 at 04:34
1

You need to think about other device types (Android at least) if you want your application to be reaching more users.

I'm doing the same now by the following way:

  1. Setup an online database with proper web services (careful with implementation for security matters - DB should NEVER be exposed by anything other than the web services).
  2. Create a Class for your communication with the server (using Class methods with security handling like authentication and authorisation).
  3. Use the class in your app to communicate with the server (SQL operations are done on the server).

To integrate with CoreData you need to create the model in your app similar to the structure in the backend database. Then you need to create a similar class for the app that deals with only local CoreData.

A higher level class might be required if you want to make sure that operations done on both server and local data storage.

Besides, you have to implement a lot of conditions to make sure that data written in local ONLY after making sure that it is stored online (or create an engine for differed operations to run later).

Another Way if you are familiar with notifications: Use structured notifications between devices for data operations in order to keep everything in sync with other users. The problem with this is the "Autonomy" of the operations. If two operations were done in approximately the same time, you have to find a way to make sure the order of the operations is done properly (maybe timestamp or something).

Ebrahim Talaq
  • 169
  • 1
  • 11
0

I'm looking into the same thing for my app and I 'think' you can do a fairly unsecured version of what you are after using using the public folder in cloud kit as mentioned in this question (no accepted answer at time of posting) : Private data sharing using CloudKit

You would need to find a way to differentiate between data that is truly public and those shared among the users you need and some level of authentication.

I'm going to try exporting a permission file with access permission in it to whomever I want to share with combined with a unique identifier located in that permission file.

Keep in mind, as mentioned in the comments of the linked answer, my implementation will be security by obscurity (thanks for that phrase) unless you find a way of adding proper validation to it but my data is relatively insensitive.

Hope this, or any ridicule in the comments, points you in the right direction : )

Community
  • 1
  • 1