I've developed an app that allow me to send messages to all users by entering a record in Public database. On each users device, the app takes that Public record and creates a record in their Private database to track the Read and Deleted status.
It works flawlessly on the simulator and about 1/3 of the devices enrolled in my TestFlight. The other 2/3 are unable to write to their Private database. In fact, the CKContainer.default().privateCloudDatabase.save() operation causes the app to crash if I let it run.
I've looked at every Google link and I just can't figure out why this works for 1/3 of the users, but not the other 2/3. Incidentally, the 2/3 of the group that can't save to their Private database are also unable to save their Notification Subscription.
All devices are running iOS 18.0 or better iPhone 11 through 16 in testing pool. Each portion of the working/not working group are a mix of iPhone versions.
if !found && checkIcloudStatus() {
CKContainer.default().privateCloudDatabase.save(loadPrivateData(n: processedMessages[index].recordName)) { returnedRecord, returnedError in
print("Adding new message to Private and error is: \(String(describing: returnedError))")
DispatchQueue.main.async {
self.processedMessages[index].record = returnedRecord ?? CKRecord(recordType: "messages_private")
self.processedMessages[index].unRead = true
self.processedMessages[index].deleted = false
}
}
}
func loadPrivateData(n: String) -> CKRecord {
let record = CKRecord(recordType: "messages_private")
record["deleted"] = "false"
record["messageId"] = n
record["unRead"] = "true"
return record
}
Post
Replies
Boosts
Views
Activity
I've developed an app that contains an inbox that displays message from a CloudKit container. Works perfectly on simulator. Once I tried to run it on a phone..in Xcode debug environment and TestFlight it is unable to complete any transactions with production database. I'm running out of ideas. So far I have tried:
Verify settings between debug and release in Signing & Capabilities
Add CloudKit.framework to Framework, Libraries, and Embedded Content
Verify record and key names
verify .entitlements files
Please help!