sgo*_*lez 4 nspredicate ios cloudkit
我正在使用具有"跟随"引用列表属性的用户记录类型的CloudKit支持的应用程序.我正在尝试构建一个查询以获取跟随指定用户的每个用户(即指定用户在以下引用列表中显示为条目的那些用户).
我正在尝试构建我NSPredicate的CKQuery原样:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%@ IN following", [[CKReference alloc] initWithRecordID:currentUserID action:CKReferenceActionNone]];
CKQuery *query = [[CKQuery alloc] initWithRecordType:UserRecordType predicate:predicate];
Run Code Online (Sandbox Code Playgroud)
并且CloudKit返回以下错误消息:
"Unknown Item" (11/2003); server message = "did not find required record type";
Run Code Online (Sandbox Code Playgroud)
我觉得我的谓词中可能会遗漏一些相当直接的东西.任何帮助将不胜感激!
使用CONTAINS运算符测试列表成员资格:
CKReference* recordToMatch = [[CKReference alloc] initWithRecordID:currentUserID action:CKReferenceActionNone];
NSPredicate* predicate = [NSPredicate predicateWithFormat:@"following CONTAINS %@", recordToMatch];
Run Code Online (Sandbox Code Playgroud)
如果要查询多个引用,则需要为列表中的每个引用使用带有AND谓词类型的复合谓词.
| 归档时间: |
|
| 查看次数: |
3530 次 |
| 最近记录: |