fix(apple): enable APNs for CloudKit cross-device sync#33
Conversation
iCloud sync between iPhone and Mac never worked because the push entitlement was missing. The app drives sync through a manual CKSyncEngine (SwiftData's cloudKitDatabase is intentionally .none), and CKSyncEngine relies on CloudKit silent pushes to wake the app and pull cross-device changes. Without aps-environment, registerForRemoteNotifications() in IOSAppDelegate failed silently, so no records ever synced. - Add aps-environment=production to FastSharedApp.entitlements (covers both iOS and macOS — same entitlement file is shared by both via project.yml). production matches the APNs environment TestFlight/App Store builds use. - Add UIBackgroundModes: [remote-notification] to the app target so iOS can launch the app in the background on CloudKit pushes; without it, sync only runs while foregrounded. - Regenerate FastSharedApp/Info.plist via xcodegen. Requires (out-of-band): enable the Push Notifications capability on the dev.kindrazki.fastshared App ID and confirm the CloudKit schema is deployed to Production, then ship a new build. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughO pull request habilita notificações remotas e execução em background para o app FastShared adicionando o entitlement de APNs em ambiente de produção e configurando os modos de background necessários em múltiplos arquivos de configuração Apple. ChangesNotificações remotas e execução em segundo plano
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
First TestFlight build carrying the CloudKit push entitlement fix (#33). 1.0.1 was the App Review-rejected version; 1.0.2 ships the cross-device sync fix (aps-environment + remote-notification background mode). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Both Apple release workflows were malformed and had never run: - apple-production.yml had the APP_STORE_CONNECT_ISSUER_ID env line duplicated ~200 times (240 lines) — GitHub rejected it at parse time (startup_failure, zero jobs). - apple-release.yml had a stray EOF_PLACEHOLDER marker at the end and was missing the xcodegen step, so xcodebuild archive had no .xcodeproj. Rewrites: - apple-production.yml: clean 50-line workflow that generates the project, decodes the ASC API key, and runs `fastlane beta_all` (iOS + macOS to TestFlight). Env vars now match exactly what the beta_all lane fetches: APP_STORE_CONNECT_API_KEY_ID, _ISSUER_ID, _API_KEY_PATH. - apple-release.yml: drop the stray marker, add Install XcodeGen + Generate Xcode project steps before archive. Unblocks the apple-v1.0.2 TestFlight build (iCloud sync fix #33). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Problema
iCloud sync entre iPhone e Mac nunca funcionou ("nada sincroniza, nunca funcionou"). Links/metadados não cruzam entre os dispositivos mesmo com a mesma conta iCloud, login feito nos dois e ambos via TestFlight.
Causa raiz
O app sincroniza via um
CKSyncEnginemanual (não o sync automático do SwiftData —cloudKitDatabase: .noneé proposital, os dois são mutuamente exclusivos). OCKSyncEnginedepende de push silencioso do CloudKit para acordar o app e puxar mudanças de outro device.Faltava o entitlement
aps-environmentem todos os.entitlements. Sem ele,registerForRemoteNotifications()(emIOSAppDelegate,FastSharedApp.swift:228) falha em silêncio → o engine nunca recebe push → zero sync.Containers iCloud iguais nos dois targets, login ok, mesma conta, TestFlight nos dois (CloudKit Production) — só faltava o canal de push.
Mudanças
FastSharedApp.entitlements:+ aps-environment = production(cobre iOS e macOS — oproject.ymlaponta o mesmo entitlement pros dois targets).productionporque TestFlight/App Store usam o ambiente APNs production.project.yml:+ UIBackgroundModes: [remote-notification]— sem isso o push só é entregue em foreground; com ele o iOS acorda o app em background nos pushes do CloudKit.FastSharedApp/Info.plist: regenerado viaxcodegen generate.Validado com
plutil -lint(entitlements + Info.plist OK).Sem isso o build do TestFlight falha ao assinar (entitlement não autorizado):
dev.kindrazki.fastshared→ ativar capability Push Notifications → Save. Regerar provisioning profile de distribuição se signing for manual.FastSharedZone/ record typeShareLink) deployed to Production (TestFlight usa o env Production).Notas
.xcschememodificado no working tree é pré-existente e ficou fora deste PR.🤖 Generated with Claude Code
Summary by CodeRabbit
Notas de Lançamento