4
我有一个具有多对子的父实体。如果我使用属性(例如名称)命令父提取,则一切正常。但是,如果我尝试这样做:具有多对多关系的NSSortDescriptor
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"[email protected]" ascending:NO];
它不起作用。我也尝试添加
[fetchRequest setRelationshipKeyPathsForPrefetching:[NSArray arrayWithObject:[entityProperties objectForKey:@"child"]]];
但它没有起作用。
我可以根据to-many排序吗?@ count或者我需要添加一个属性并在每次添加一个孩子时更新它?
谢谢。我感到困惑,因为它听起来像根据你在这里给出的答案是可能的:http://stackoverflow.com/questions/2448252/core-data-nsfetchrequest-sorting-by-count-of-to-many-relationship – Adriana