我正在开发一个 CloudKit 支持的应用程序,其用户记录类型具有“以下”参考列表属性。我正在尝试构建一个查询来获取关注指定用户的每个用户(即指定用户在以下参考列表中显示为条目的那些用户)。
我目前正在尝试构建我的NSPredicate
为了CKQuery
像这样:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%@ IN following", [[CKReference alloc] initWithRecordID:currentUserID action:CKReferenceActionNone]];
CKQuery *query = [[CKQuery alloc] initWithRecordType:UserRecordType predicate:predicate];
CloudKit 返回以下错误消息:
"Unknown Item" (11/2003); server message = "did not find required record type";
我觉得我的谓词中可能遗漏了一些非常直接的东西。任何帮助将不胜感激!
使用 CONTAINS 运算符测试列表成员资格:
CKReference* recordToMatch = [[CKReference alloc] initWithRecordID:currentUserID action:CKReferenceActionNone];
NSPredicate* predicate = [NSPredicate predicateWithFormat:@"following CONTAINS %@", recordToMatch];
如果要查询超过 1 个引用,则需要对列表中的每个引用使用 AND 谓词类型的复合谓词。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)