为什么我不能查询CloudKit在Xcode或CloudKit仪表板?

问题描述 投票:0回答:1

当我尝试从CloudKit仪表板查询CloudKit,我得到一个错误,指出:

有查询“入口”类型的问题。

没有身份验证方法发现

当我尝试从在Xcode代码查询相同的记录,我从我的查询操作的我queryCompletionBlock属性错误对象的错误信息:

操作无法完成。 (CKErrorDomain错误4。)

在哪里可以找到什么样的错误4种手段?

下面是印在调试窗口错误消息的代码:

let predicate = NSPredicate(value: true)
let query = CKQuery(recordType: DatabaseNameStrings.recordTypeEntry, predicate: predicate) // DatabaseNameStrings.recordTypeEntry = "Entry"
let sortDescriptor = NSSortDescriptor(key: DatabaseNameStrings.recordFieldKeyCreationDate, ascending: true)
query.sortDescriptors = [sortDescriptor]
let queryOperation = CKQueryOperation(query: query)
queryOperation.database = container.privateCloudDatabase
queryOperation.desiredKeys = [DatabaseNameStrings.fieldNameText] // DatabaseNameStrings.fieldNameText = "text"
queryOperation.recordFetchedBlock = {
    (record: CKRecord) in
    let entry = Entry(ckRecord: record)
    self.entries.append(entry)
}
queryOperation.queryCompletionBlock = {
    (cursor: CKQueryOperation.Cursor?, error: Error?) in
    if let error = error {
        print(error.localizedDescription) // The operation couldn’t be completed. (CKErrorDomain error 4.)
    } else {
        DispatchQueue.main.async {
            self.tableView.reloadData()
        }
        if let cursor = cursor {
            let innerQueryOperation = CKQueryOperation(cursor: cursor)
            innerQueryOperation.desiredKeys = queryOperation.desiredKeys
            innerQueryOperation.recordFetchedBlock = queryOperation.recordFetchedBlock
            innerQueryOperation.queryCompletionBlock = queryOperation.queryCompletionBlock
            queryOperationQueue.addOperation(queryOperation)
        } else {
            DispatchQueue.main.async {
                self.tableView.reloadData()
            }
        }
    }
}
queryOperationQueue.addOperation(queryOperation)
ios xcode cloudkit ckqueryoperation
1个回答
0
投票

它开始工作,我没有做任何事情来解决它。

© www.soinside.com 2019 - 2024. All rights reserved.