0

我似乎无法在我的公共数据库中修改某些记录。错误是“错误保存记录 <CKRecordID: XXXXXXX; recordName=XXXXXX, zoneID=_defaultZone: defaultOwner > to server: WRITE operation not allowed”。我不明白为什么它说不允许写入,因为我在仪表板中检查了所有正确的安全角色。在我尝试修改记录之前,我还确认它已登录到 Icloud。这

// MARK: - Modify Updates in Cloudkit
static func modifyUpdates(item: pushNote, completion: @escaping (Result<pushNote, Error>) ->
    ()) {
    guard let recordID = item.recordID else { return }
    CKContainer.default().publicCloudDatabase.fetch(withRecordID: recordID) { (record, err) in
        DispatchQueue.main.async {
            if let err = err {
                completion(.failure(err))
                return
            }
            guard let record = record else { return }
            
            
            record["updates"] = item.updates as CKRecordValue
            
            CKContainer.default().publicCloudDatabase.save(record) { (record, err) in
                DispatchQueue.main.async {
                    if let err = err {
                        completion(.failure(err))
                        return
                    }
                    guard let record = record else { return }
                    let id = record.recordID
                    guard let updts = record["updates"] as? [String] else { return }
                    guard let boss = record["bossID"] as? String else { return }
                    
                    let element = pushNote(recordID:id, bossID: boss, updates : updts)
                    completion(.success(element))
                }
            }
        }
    }
}
4

1 回答 1

0

保存安全角色更改需要时间来完成。对我来说就像 10 分钟。我建议不要点击保存太多次。注销并重新登录以查看它是否实际保存。

于 2020-09-19T02:04:42.163 回答