I want to write an NSPredicate for a CloudKit query on a database created using NSPersistentCloudKitContainer
.
Normally this is quite easy, but in my case I want this predicate to filter the entities according to a many-to-many property. This seems to be much harder than filtering by other CloudKit properties, as it seems that NSPersistentCloudKitContainer
creates a dedicated "CDMR" table to handle many-to-many relationships [link to doc specifying this].
So if I am understanding correctly, I have to first query this CDMR table, get the entity IDs of the entities which satisfy said many-to-many relationship, and then fetch the entities themselves. It seems it would take 2 fetch requests, or more I am not sure yet. Is there a less cumbersome way to do this? Ideally on a single fetch request to CloudKit?
question from:
https://stackoverflow.com/questions/65874714/how-to-write-a-cloudkit-nspredicate-for-a-many-to-many-relationship-on-cloutkit 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…