gpt4 book ai didi

cloudkit - CKQuery 哪里谓词有引用而不是字段?

转载 作者:行者123 更新时间:2023-12-02 12:00:48 28 4
gpt4 key购买 nike

我需要创建一个CKQuery,其中谓词包含记录的引用,而不是记录的字段。

像这样

let query = CKQuery(recordType: "OUP", predicate: NSPredicate(format: "o = %@", "FF4FB4A9-271A-4AF4-B02C-722ABF25BF44")

如何设置o是CKReference,而不是字段!

我收到此错误:

字段“o”的查询谓词中的字段值类型不匹配

最佳答案

您可以使用 CKRecordCKRecordID(带或不带 CKReference)来匹配关系。

CK记录:

let predicate = NSPredicate(format: "artist == %@", artist)

CKRecordID:

let predicate = NSPredicate(format: "artist == %@", artistID)

CKReference 与 CKRecord:

let recordToMatch = CKReference(record: artist, action: CKReferenceAction.None)
let predicate = NSPredicate(format: "artist == %@", recordToMatch)

带有 CKRecordID 的 CKReference:

let recordToMatch = CKReference(recordID: artistID, action: CKReferenceAction.None)
let predicate = NSPredicate(format: "artist == %@", recordToMatch)

关于cloudkit - CKQuery 哪里谓词有引用而不是字段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24961807/

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