gpt4 book ai didi

ios - 为什么我无法从 Xcode 或 CloudKit Dashboard 查询 CloudKit?

转载 作者:行者123 更新时间:2023-11-29 06:02:13 28 4
gpt4 key购买 nike

当我尝试从 CloudKit Dashboard 查询 CloudKit 时,收到一条错误消息:

There was a problem querying the “Entry” type.

no auth method found

当我尝试从 Xcode 中的代码查询相同的记录时,我从查询操作的 queryCompletionBlock 属性中的错误对象中收到错误消息:

The operation couldn’t be completed. (CKErrorDomain error 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 Dashboard 查询 CloudKit?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54531840/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com