English 中文(简体)
NSSort Descriptor with to-many relationship
原标题:NSSortDescriptor with to-many relationship
  • 时间:2011-10-20 16:42:37
  •  标签:
  • core-data

我有一个父母实体,必须抚养孩子。 如果我命令父母一方拥有财产(例如姓名),所有物品都会被罚款。 但是,如果我尝试这样做的话:

NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"child.@count" ascending:NO];

它没有工作。 我也试图补充。

[fetchRequest setRelationshipKeyPathsForPrefetching:[NSArray arrayWithObject:[entityProperties objectForKey:@"child"]]];

但它也没有工作。

我允许用手法进行分类,或者我是否需要增加财产,每增加一名儿童时更新财产?

最佳回答

假设你正在使用一种油罐;不能通过<条码>@count进行分类。 由于在“目标”一级解决了这一问题,而<代码>NSSortDescriptor上则在数据库一级解决。 因此,正如你所猜测,你需要创造计票财产。

如果你使用双轨或内层储存类型,那么计值就应当进行罚款,因为它们只能作为物体进入。

问题回答

暂无回答




相关问题
iPhone Core Data Recursive Relationships

I m having some trouble with a recursive relationship in core data. I ve got a managed object called a "SearchCategory", and that category can have "Categories" and it can also have a "Category." In ...

Plist Hierarchy and All Option

I have a string of data in a plist, which I ve got to display, hierarchically like this: Menu>Chapter>SubChapter>item>item details This might be super simple, in my initial menu, how would I have ...

Fetched Properties v Relationships (Core Data - iPhone)

I m a new iPhone developer (of about 4 months or so) who is starting to look at Core Data. In the "Beginning iPhone 3 Development" book by Dave Mark it mentions that the main difference between ...

Cocoa Core Data newbie how-tos

I am one of the great unwashed masses of .NET developers keen to try their hands at Mac OS X development. At the moment I am trying to figure out the various elements of Cocoa and getting a bit stuck ...

中间储存的核心数据

我想将核心数据作为输入数据库服务器更大数据集的切身。

Limit the returned resultset in CoreData

In CoreData, if I want to limit the returned resultset to 100, is it enough to just set the fetch limit to 100, or do I need to set the fetch batch size to 100 as well?

热门标签