Is Core Data hosted in CloudKit working in Xcode 13?

Hi, I'm pretty new to SwiftUI. I created a project in Xcode 12 using CoreData and Hosted in CloudKit. This auto-generated some code which (mostly) works (the template did not display the add or edit buttons in iOS / iPadOS since it lacks a navigation view [I know it is just an example view to get started, but I was surprised by this] and is also missing a mergePolicy and automaticallyMergesChangesFromParent to see results in a timely fashion [well around 15 seconds or so])... anyway... I got that figured out and it works well in the iOS / iPadOS simulators in Xcode 12 plus when run on my iPod touch and iPad Pro with the same version OS.

I just tried opening the project in Xcode 13 Beta and the iOS / iPadOS simulators to look around and right away, the syncing with iCloud isn't working. Is there something new required? Xcode 13 isn't showing any warnings or cautions with the code. Is this just a bug in the current beta that needs to be fixed? I'm also curious, is there a way to use the new concurrency in SwiftUI with the syncing between Core Data and iCloud if I wanted to check if something already exists in iCloud after it is done syncing before automatically generating some new data?

I'm attaching the errors reported in Xcode 13 Beta as the simulator ran the project:

Accepted Reply

I was able to get it to work today after updating to beta 3 versions. I did have to do a erase all contents and settings on the simulator and once that was done data from CloudKit came into my app.

  • Great. I haven’t had a chance to test it myself on Beta 3. I will try to do so in the next few days. If working, I should be able to update Feedback ticket.

  • I tried it out using Xcode 13 Beta 3. It now works after I did the Erase All Contents and Settings on iOS 15 iPhone 12 Pro simulator. I will look to close associated radar (feedback).

  • I've been trying but Beta 3 is failing with provisioning errors for me when I try to connect to a container...

Replies

Exact same issue here.

Looking at the logs, it appears the issue might be related to <CKError 0x60000015a400: "Internal Error" (1/5000); "Failed to sync user keys"> as almost every line with an error has that message.

Edit: I meant to comment instead of answer.

I talked with Apple about this during a lab session at WWDC21. They had me create a feedback ticket.

Here is the Feedback: FB9156589

  • Closed this Feedback on today.

Add a Comment

Im having exactly the same problem. So far no resolution. Definitely seems to be the beta, as I've build the "CoreData + CloudKit" boilerplate app in Xcode 12.x which works, and then built the same with Xcode 13 which breaks.

Did you also notice that when you go back to Xcode 12.x, the old "minimise to refresh" trick doesn't work anymore? You have to close the app and restart it for the iCloud data to get pulled.

It seems to work on the device but not on the simulator.

  • It's not working on devices either for me. The schema updates as expected, but records don't appear to land in the database, despite reporting a successful change.

Add a Comment

Has anyone been able to get this to work in Beta 2? Still looks broken to me...

  • No change yet. Feedback is still open.

Add a Comment

I was able to get it to work today after updating to beta 3 versions. I did have to do a erase all contents and settings on the simulator and once that was done data from CloudKit came into my app.

  • Great. I haven’t had a chance to test it myself on Beta 3. I will try to do so in the next few days. If working, I should be able to update Feedback ticket.

  • I tried it out using Xcode 13 Beta 3. It now works after I did the Erase All Contents and Settings on iOS 15 iPhone 12 Pro simulator. I will look to close associated radar (feedback).

  • I've been trying but Beta 3 is failing with provisioning errors for me when I try to connect to a container...

I just tried it out here. Thanks for the info about erasing all contents and settings in the simulator (I would not have thought to try that). It is now working after doing so.

Seems like a new issue in Beta 4 resulting in this error:

"Account Temporarily Unavailable" (1028/2011); "Account temporarily unavailable due to bad or missing auth token"

'Reset All Contents & Settings' on the simulator doesn't appear to fix it this time.

I've also noticed that the current App Store release version of my App which uses NSPersistentCloudKitContainer does not sync properly and crashes after 30 seconds. Nothing has changed other than installing Beta 4. I've submitted a bug report to Apple.

  • I'm seeing the same "Account Temporarily Unavailable" (1028/2011); "Account temporarily unavailable due to bad or missing auth token" problem. I'm hoping this can be fixed sever-side, as I'm blocked right now and don't want to wait for 2 more weeks for a fix.

  • Seeing similar issue on macOS Monterey Beta 4, but not on iOS 15 Beta 4 CKError 0x600002b22af0: "Account Temporarily Unavailable" (36/1028); "Account temporarily unavailable due to bad or missing auth token

    It happens even using Xcode App Store version, so it's likely a operating system bug

  • nitramluap - please provide the Feedback ticket number for the bug report you made for reference on this thread and so that others can track in Feedback Assistant.

My CloudKit enabled macOS apps are suffering from exact the same error message when running macOS 12 beta 4. This happens on 2 different Macs running the same beta. As if developing for Apple is not already challenging enough.

  • Same problem here with macOS Monterey Beta 4, syncing CoreData to CloudKit does not work with the new Beta 4 operating system, tested with Xcode beta 3 and beta 4.

  • Immediately on release everything seemed to work fine - I've only had this crop up today... strange

Add a Comment

Fixed for me on iOS 15 Beta 5, out today.

  • Not for me. Still not working in simulators & devices (authentication error). Running my App Store version of my app on beta 5 results in no syncing at all - it 'starts' a sync... then nothing, nothing, nothing -> crash to springboard with no error. Ugh. Crash logs give no meaningful information. I've submitted a sysdiagnose to Apple and have a Feedback Assistant report here (FB9412346)

  • nitramluap - thanks for Feedback Assistant reference.

Add a Comment