我有一个父实体,它有很多孩子.如果我使用属性(例如名称)命令父获取,一切正常.但如果我试试这个:
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"child.@count" ascending:NO];
Run Code Online (Sandbox Code Playgroud)
它不起作用.我也尝试过添加
[fetchRequest setRelationshipKeyPathsForPrefetching:[NSArray arrayWithObject:[entityProperties objectForKey:@"child"]]];
Run Code Online (Sandbox Code Playgroud)
但它没有奏效.
我允许按照多个来排序.@ count或我是否需要添加属性并在每次添加孩子时更新它?
core-data ×1