带有OR返回错误的NSPredicate

我有以下谓词的问题:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(creatorUserRecordID == %@) OR (toUser == %@)", userId, userId]; 

当我在查询中使用它CKQuery *query = [[CKQuery alloc] initWithRecordType:@"Message" predicate:predicate]; 我有一个错误,说:'CKException',原因:'意外的expression'。

当我这样分别使用这两个:

  NSPredicate *predicate1 = [NSPredicate predicateWithFormat:@"(creatorUserRecordID == %@)", userId]; NSPredicate *predicate2 = [NSPredicate predicateWithFormat:@"(toUser == %@)", userId]; 

然后用这些谓词之一进行查询,它工作正常。 我也尝试使用NSCompoundPredicate,但结果总是相同的…任何想法?

CKQuery的文档列出了所有有效的谓词语法。 奇怪的是,在“基本复合谓词”下列出了NOTAND&&OR|| 没有列出,显然不支持CloudKit查询谓词。