Post

Replies

Boosts

Views

Activity

Reply to CKShare save fails with BAD_REQUEST on _pcs_data in Production private database
Resolved. Two separate causes, neither visible from the client-side CKError. The Production schema was missing the system record type cloudkit.share. Enabling verbose error output in our own build surfaced the real server text: CKError 12 - Cannot create new type cloudkit.share in production schema CloudKit Console confirmed neither Development nor Production had cloudkit.share (only our own MedStatus and Users). This type cannot be created by hand in the console. It is auto-created the first time a share is actually saved in the DEVELOPMENT environment, and then must be pushed with Deploy Schema Changes. Our app had only ever run against Production (TestFlight / App Store builds), so that type was never created. The BAD_REQUEST on _pcs_data was the downstream symptom, not the cause. Fix: install a Debug build on a device (Development environment), perform one share, confirm cloudkit.share appears under Record Types, then Deploy Schema Changes to Production. Note for testing Production on-device: a Release configuration is not enough. If the build is signed with a development certificate it still targets Development unless the entitlement com.apple.developer.icloud-container-environment is explicitly set to Production. Acceptance was never delivered to the app (SwiftUI / scene-based apps). After sharing worked, tapping the invitation link opened the app but nothing happened. SwiftUI apps get a UIApplicationSceneManifest generated automatically, so they are scene-based, and iOS delivers the accepted share to UIWindowSceneDelegate.windowScene(_:userDidAcceptCloudKitShareWith:) not to UIApplicationDelegate.application(_:userDidAcceptCloudKitShareWith:). With CKSharingSupported = YES the link still launches the app, so the failure looks like "the app opens and silently does nothing". Fix: return a UISceneConfiguration with a delegateClass from application(:configurationForConnecting:options:), implement the scene method, and also handle connectionOptions.cloudKitShareMetadata in scene(:willConnectTo:options:) for the cold-launch path. Both are now confirmed working on a real device.
Topic: App & System Services SubTopic: iCloud Tags:
Aug ’26
Reply to CKShare save fails with BAD_REQUEST on _pcs_data in Production private database
Resolved. Two separate causes, neither visible from the client-side CKError. The Production schema was missing the system record type cloudkit.share. Enabling verbose error output in our own build surfaced the real server text: CKError 12 - Cannot create new type cloudkit.share in production schema CloudKit Console confirmed neither Development nor Production had cloudkit.share (only our own MedStatus and Users). This type cannot be created by hand in the console. It is auto-created the first time a share is actually saved in the DEVELOPMENT environment, and then must be pushed with Deploy Schema Changes. Our app had only ever run against Production (TestFlight / App Store builds), so that type was never created. The BAD_REQUEST on _pcs_data was the downstream symptom, not the cause. Fix: install a Debug build on a device (Development environment), perform one share, confirm cloudkit.share appears under Record Types, then Deploy Schema Changes to Production. Note for testing Production on-device: a Release configuration is not enough. If the build is signed with a development certificate it still targets Development unless the entitlement com.apple.developer.icloud-container-environment is explicitly set to Production. Acceptance was never delivered to the app (SwiftUI / scene-based apps). After sharing worked, tapping the invitation link opened the app but nothing happened. SwiftUI apps get a UIApplicationSceneManifest generated automatically, so they are scene-based, and iOS delivers the accepted share to UIWindowSceneDelegate.windowScene(_:userDidAcceptCloudKitShareWith:) not to UIApplicationDelegate.application(_:userDidAcceptCloudKitShareWith:). With CKSharingSupported = YES the link still launches the app, so the failure looks like "the app opens and silently does nothing". Fix: return a UISceneConfiguration with a delegateClass from application(:configurationForConnecting:options:), implement the scene method, and also handle connectionOptions.cloudKitShareMetadata in scene(:willConnectTo:options:) for the cold-launch path. Both are now confirmed working on a real device.
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Aug ’26