I have successfully saved a CKShare URL to CloudKit, and I can see that the user is INVITED in the CloudKit Dashboard. My Mac app emailed the URL to that person, but when they click it, all they see it this screen on icloud.com:
Clicking OK makes everything disappear so all you see is the background on the web page.
My understanding is that the URL is supposed to open my Mac app where it will fire userDidAcceptCloudKitShareWith in my app delegate. But it does nothing.
Could this be because my app is in development and not in the Mac App Store yet? Do I need a custom URL scheme to get it to open my app?
Documentation on this stuff is pretty sparse. I'd love any help someone can provide.

I have since learned that you must specify a fallback URL for your CloudKit container. In cases where the app isn't installed (or isn't recognized, which seems to be the case when doing dev builds in Xcode like I am), CloudKit will forward share URL to somewhere you specify. They append the unique share ID to the URL so that you can process it on your own web page.
In the CloudKit dashboard, go to Environment Settings... and you'll see this popup:
I have it redirect to
https://myapp.com/share/?id=and on my web page where it redirects to, I do a$_GET['id']to grab theid. I then do another redirect to my application using a custom URL scheme and pass the share ID (e.g.myapp://abc123whereabc123is the share ID).In my app delegate, I receive the URL like this:
I then use
CKFetchShareMetadataOperationto look up the URL of the share andCKAcceptSharesOperationto accept it like this:I think there are easier ways to work through this using
NSItemProviderandNSSharingService, but I'm doing a lot of custom UI and wanted to have full control of the share workflow.I hope this helps someone. :)