I'm continually getting an error with a new CloudKit container when I try to save data.
error: Couldn't get container configuration from the server for container "iCloud.com.***.***"
here's the class:
private var db = CKContainer(identifier: "iCloud.com.***.***").privateCloudDatabase
func addTask(taskItem: TaskItem) async throws {
checkStatus()
do {
try await db.save(taskItem.record)
} catch {
print("error: \(error.localizedDescription)")
}
}
func checkStatus() {
let id = CKContainer(identifier: "iCloud.com.***.***").containerIdentifier
print(id ?? "unknown")
Task {
let status = try await CKContainer(identifier: "iCloud.com.***.***").accountStatus()
switch status {
case .available:
print("available")
case .noAccount:
print("no account")
case .restricted:
print("restricted")
case .couldNotDetermine:
print("could not determine")
case .temporarilyUnavailable:
print("temporarily unavailable")
@unknown default: break
}
}
}
The account status reports as available but gives the error on an attempt to save.. I'm trying to work out what I might be doing wrong..