5
NSFetchRequestの結果タイプをNSDictinaryResultTypeに設定すると、ゼロオブジェクトが返されます。 setPropertiesToFetchとsetResultTypeを削除すると、すべてのオブジェクトが返されます。コアデータNSFetchRequest setResultType:NSDictionaryResultTypeが機能しない
アイデア?
NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Alert" inManagedObjectContext:_managedObjectContext];
[request setEntity:entity];
NSDictionary *entityProperties = [entity propertiesByName];
[request setPropertiesToFetch:[NSArray arrayWithObject:[entityProperties objectForKey:@"test"]]];
[request setResultType:NSDictionaryResultType];
NSError *error;
NSArray *result = [_managedObjectContext executeFetchRequest:request error:&error];
if (result == nil) {
NSLog(@"Error: %@", [error localizedDescription]);
}
はい、これは本当の問題です。 NSDictionaryResultsTypeを使用する場合、管理対象オブジェクトコンテキストで保留中の変更の結果を取得することはできません。 – Aderstedt