我对Cocoa中的核心数据模型有问题。这可能是一个相当基本的问题。下面显示了我的核心数据模型的一部分。给定OutputCell实体中单元格属性的值,我想返回相关的直方图栏。
NSEntityDescription *histogramBarEntityDescription = [NSEntityDescription entityForName:@"HistogramBar"
inManagedObjectContext:[theDocument managedObjectContext]];
NSFetchRequest *histogramBarRequest = [[[NSFetchRequest alloc] init] autorelease];
[histogramBarRequest setEntity:histogramBarEntityDescription];
NSPredicate *histogramBarPredicate = [NSPredicate predicateWithFormat:@"(histogram.outputCell.cell = %@)", theOutputCell];
[histogramBarRequest setPredicate:histogramBarPredicate];
NSError *histogramBarError = nil;
NSArray *histogramsArray = [[theDocument managedObjectContext] executeFetchRequest:histogramBarRequest
error:&histogramBarError];
谢谢你的帮助。