Skip to content

fix(#277): specify CloudKit container for iCloud sync#285

Merged
cassio-rossi merged 1 commit intorelease/v5from
fix/icloud-sync-favorites
Apr 30, 2026
Merged

fix(#277): specify CloudKit container for iCloud sync#285
cassio-rossi merged 1 commit intorelease/v5from
fix/icloud-sync-favorites

Conversation

@cassio-rossi
Copy link
Copy Markdown
Collaborator

Summary

  • Favorites were not syncing between devices because SwiftData's .automatic CloudKit mode looks for the default container (iCloud.com.brit.macmagazine), but the app's entitlements declare iCloud.com.brit.macmagazine.cloudkit
  • Fixed by explicitly passing .private("iCloud.com.brit.macmagazine.cloudkit") to the Database initializer so SwiftData uses the correct CloudKit container

Closes #277

Test plan

  • Sign into iCloud on two devices (iPhone + Mac or iPhone + iPad)
  • Favorite an article on device A
  • Verify the favorite appears on device B after a short sync delay
  • Unfavorite on device B, verify it unfavorites on device A
  • Fresh install: verify existing favorites sync down from iCloud

🤖 Generated with Claude Code

The Database was initialized without a cloudKitDatabase parameter,
defaulting to .automatic which looks for iCloud.com.brit.macmagazine.
The app's entitlements declare iCloud.com.brit.macmagazine.cloudkit,
causing SwiftData to silently skip sync. Explicitly passing
.private with the correct container identifier fixes the mismatch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cassio-rossi cassio-rossi merged commit 1c040a5 into release/v5 Apr 30, 2026
2 checks passed
@cassio-rossi cassio-rossi deleted the fix/icloud-sync-favorites branch April 30, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Favoritos não estão sincronizando

2 participants