English 中文(简体)
NSFetchRequest setProperties TogroupBy: Return all entities that对等?
原标题:Does NSFetchRequest setPropertiesToGroupBy: return all entities that match?

I m 开发一个SOS,我可以找到关于新的方法的许多文件。

我拥有与多个实体B物体有关系的物体。

我想举出所有实体B物体,这些物体符合特定模式,并按实体A分类。 因此,我没有为每个实体A单独设一个银团。 理想的做法是将结果结构化,以便我能够把平等实体的集团 over为一,然后所有实体都将拥有。 Bs 调和模式,从一个单列要求。

我可以看到<代码>Properties TogroupBy:。 方法应当让我按逆向B->进行分类;A关系,并回归一系列的<代码>NSDictionaries。 但是,这是否意味着每个项目在<代码>NSArray上按实体A对应一个组? 相应的<代码>NSManagedObject的子类可在中找到某些地方。 NSDictionary ?

最佳回答

无。 这样做有两个途径:

  • Use multiple requests
  • Have one request to get all A entities where the inverse A->B relationship is in a group of Bs. Then include an NSSortDescriptor to sort by B and separate the results in to groups.

后者可能较快,因为中间分裂避免了非银的多次准入和单列要求。

问题回答

暂无回答




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签