質問

Cocoaのコアデータモデルに問題があります。これはおそらくかなり基本的な問題です。コアデータモデルのセクションを以下に示します。 OutputCellエンティティのセルプロパティの値を指定すると、関連するHistogramBarを返します。

 TwitpicでTwitterで写真を共有する

次の述語を使用していますが、空の配列を返すだけです。 Histogramエンティティを使用してなんとか動作させることができましたが、HistogramBarからHistogramを介してOuputCellに移動することはできません。私が使用している述語は次のとおりです。

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];

助けてくれてありがとう。

役に立ちましたか?

解決

私の問題は解決しました。コード内の不正なコメントにより、HistogramBarエンティティが作成されませんでした。この例では、いくつかのNSLogの詳細なチェックが問題の発見に役立ちました。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top