In my app I want to share data via iCloud with other iCloud users but not with the whole world but with selected other iCloud users.
I thought about a way this could work, but I am not sure if it will work and if I forgot or misunderstood some things.
Let s say User A wants to be able to share a string with other iCloud users but not with everyone. So User A wants to share „Hello World“ to User B but not to user C and not to User D.
So my app has a Public Data Base and a Record Type that is the same for everyone. In that Record Type there is a Field of type String that is also the same for everyone.
Now User A saves the record „Hello World“ to iCloud. And here comes the trick: I would add a unique identifier like UUID to the string so that something like „Hello World1230ABD6-3C61-1234-802E-D866F09AC012“ will be uploaded to iCloud.
Now User A needs to tell the User he wants to share the data with his UUID, so User A tells it to User B. Now the UUID of User A will be added as a Predicate to the CKSubscription of User B.
This will allow User B to fetch the string from User A, but User C or User D won t receive a CKNotification because they don t have the UUID of User A in their CKSubscription.
Is this going to work? Or is there another design pattern that allows sharing/syncing via iCloud with other iCloud accounts but not with everyone (public) ?
P.S. The data I want to share is not sensitive, so it does not need to be really secure. The data just isn t interesting for everyone (public) so it needs to be shared only to selected other iCloud accounts...
I am thankful for any thoughts or tips how to achieve this !
Thanks
Sync user data between multiple apps from the same developer If you have a suite of apps, they can all share the same CloudKit container so users can have access to their data for all of your apps on every device they have associated with their iCloud account.
Yes you will require paid developer account for CloudKit.
Configuring CloudKit MirroringSynchronize objects between devices, and handle store changes in the user interface. Reading CloudKit Records for Core Data. Access CloudKit records created from Core Data managed objects.
You use CloudKit to store your app's existing data in the cloud so that the user can access it on multiple devices. You can also store data in a public area where all users can access it.
CloudKit Sharing was introduced at WWDC 2016. This allows sharing of private database records between a known set of users, which is what it sounds like you're looking for. ...... There is a great overview in the "What's new in CloudKit" session: https://developer.apple.com/videos/play/wwdc2016/226/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With