CloudKit in TestFlight: No sync between devices 😭

I have read and tried all the possible solutions available online, but still didn't get a result.

My multi-platform iOS/macOS app uses private databases in iCloud with Core Data. All works as expected when I build the app from Xcode to my multiple devices: data is being synced. But when I upload the app to TestFlight, data is not being synced.

This is what I have already tried:

  1. In CloudKit Dashboard, I reset the schema and deployed schema changes from the development to production.

  2. In Xcode project settings, in Targets, under Frameworks, Libraries... I added the CloudKit.framework, set as "do not embed".

  3. In Xcode project settings, under Signing & Capabilities, all the CloudKit, Background fetch and Remote notifications checkboxes are enabled for both Debug and Release. They all point to the same correct iCloud container.

  4. In Xcode project settings, under Build Settings, Code Signing Entitlements for both Debug and Release point to the same entitlements file.

  5. In .entitlements file, CloudKit container identifier points to the correct container. iCloud Services set to CloudKit.

  6. In .entitlements file, APS Environment for both iOS and macOS is set as "production".

  7. In Core Data .xcdatamodeld file, under Configurations, I have a Default option, and it is being set to "Used with CloudKit."

  8. Each time I upload new version to the TestFlight, I delete all the previous versions from all my devices, so development and production containers are not mixed up in any way.

I understand that I may be missing something. But after researching all the resources available online, I didn't find anything else to configure or to add in this setup. I want to point out again that data is not being synced only in TestFlight, and thus, possibly, after release. Whenever I build app directly to the device from Xcode, all works as expected.

I hope someone can help me.

Answered by DTS Engineer in 790728022

In this situation, you might consider capturing and analyzing a sysdiagnose. The following technote discusses how to do so:

The following related technote may also help:

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

In this situation, you might consider capturing and analyzing a sysdiagnose. The following technote discusses how to do so:

The following related technote may also help:

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Accepted Answer

The issue is now resolved, and the problem was neither in Core Data, nor in code / CloudKit. Simply the iCloud storage was full. But I didn't know that, because it was an account of the QA team member, not mine. And this is extremely tricky. So I want to keep this thread, and I will describe now how it was solved:

  1. Returned to the version where none of the solutions listed in the original message were implemented.

  2. Managed to isolate the issue only for macOS by resetting the CloudKit environment and deploying the schema changes (worked for devices connected to my account).

  3. Solved the issue for macOS by following the step 2 of the original message. Yes, as many people mentioned, seems it is crucial to have this framework added (worked for devices connected to my account).

  4. Analysed the CloudKit dashboard (Telemetry) and got two know that at least 10 errors in the last half an hour came with the label "QUOTA_EXCEEDED".

And that was it, next minute it all was clear for me. After they've emptied some space in their iCloud, the issue was resolved.

Cheers,

CloudKit in TestFlight: No sync between devices 😭
 
 
Q