Cloudkit multi-user, multi-app question

I have a Mac app. I would like to make this multiuser. It currently uses Core Data as it's persistent store. I have started looking into Cloudkit as a way to sync the database.


I have 3 questions:


1) Can multiple users with different Apple ID's access the CloudKit database from my app?

2) If I create another app (different bundle identifier) which would also access this data, is this possible?

3) Can I create an iOS app which could access the Cloudkit database?

Replies

I believe the answers are all 'yes'. The different iCloud Account's only share the 'p[ublic' space, not the private space. Different apps can access the same space if they specify custom containers. And iOS and Mac apps share CloudKit.

I need to clarify this question. Here is the setup I need:


I have a Mac business app which would store data in Cloudkit. A typical company whould have multiple users. I store the data in a core database on the Mac. I would like to use cloudkit to facilitate keeping the databases in synch. The way I understand it, cloudkit allows a public database which all users of the app could access. There is also a private database for each user. I want each of the companies to have their own container for that company's data. If I put the data in a private container, then it seems like the users would all need the same user id, which would be very inconvenient for the users. If I put the data in the public container, all companies would have their data in the public container. As this is all confidential financial data, I don't think the customers would like this.


Is there a way to set up a private container which is accessible to multiple users? I think that would solve the issue.

You asked "Is there a way to set up a private container which is accessible to multiple users? " The private container is defined by the user's iCloud Account. YOu could set up a shared iCloud Account and have all users log into that. But that's quite inconvenient and subject to abuse. So here's another approach:


Use your own system for filtering what records a company can download. While it's all 'in the public database' the only access to that databse is through your app. So that gives some level of security to each company. In addition, take the records and encode them somehow with a key/password that the company shares with its employees. I have no idea how to actually do that - but I am sure it is a well documented concept.

Add a Comment