Unable to use OR operator with 2 predicates

55 Views Asked by At

I have two predicates that when both used individually work absolutely fine, however when I try to combine them in an OR, I get:

<CKError 0x600000c71320: "Invalid Arguments" (12/1009); "Invalid predicate: Unexpected expression: etc....

These are the two predicates that both work individually:

let predicate1 = NSPredicate(format: "creatorUserRecordID IN %@ AND NOT(recordID IN %@)", referencesForUsersIFollow, cachedUserAccountsRecordIDS)
let predicate2 = NSPredicate(format: "creatorUserRecordID IN %@ AND recordID IN %@ AND modificationDate > %@", referencesForUsersIFollow, cachedUserAccountsRecordIDS, userAccountsCacheLastUpdated as CVarArg)

And I use this to combine them, which is when the problem comes in:

let combinedPredicate = NSCompoundPredicate(orPredicateWithSubpredicates: [predicate1, predicate2])

Any help would be greatly appreciated!

0

There are 0 best solutions below