Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you share data on CloudKit between different apps

Tags:

ios

cloudkit

I have a free and paid version of my app in the app store. I'm updating the app to share some public data using CloudKit. I'd like both the free and paid apps to share the same data.

Firstly is it possible for two apps to share the same data with CloudKit?

If so, how can I get this to work? I've tried enabling CloudKit in the capabilities of both targets and selecting the same container in both apps. The main app which has 'Use default container' selected works fine, but the other app, on which I've selected 'Specify custom containers' and selected the custom container from the first target, gets an error back when I try to download anything.

like image 917
Mark Bridges Avatar asked Nov 02 '15 13:11

Mark Bridges


People also ask

How does CloudKit sharing work?

When an invited user taps or clicks the share URL, CloudKit verifies they have an active iCloud account, which must match their participant details. After successful verification, the system launches your app. CloudKit provides share metadata to your app's scene delegate or app delegate.

Do CloudKit apps sync with iCloud users?

This is perhaps the most obvious use for CloudKit: syncing your users' data across their devices. Example: a note taking app where the user can create and read notes on any device associated with their iCloud account. Alternatives: Realm Mobile Platform, Firebase, iCloud KVS, iCloud Documents, custom web app.

Is CloudKit a backend?

CloudKit it's Apple's Backend as a Service platform and it's specially designed for iOS apps. CloudKit was introduced in the year 2014 as an amazing solution to integrate iCloud in your applications with ease. This cloud solution has been introduced by Apple.


1 Answers

Yes, multiple apps can use the same CloudKit data. When you get your CKContainer, I assume you are using something like the following for both apps?

let container = CKContainer.defaultContainer()

This would work for the main app (the one with the bundle identifier that matches the cloudkit identifier). The other app(s) will need to initialize the container like so:

let container = CKContainer(identifier: "iCloud.com.example.appname")
like image 173
lehn0058 Avatar answered Oct 26 '22 20:10

lehn0058