我有一个 iPad 应用程序,其中数据存储在core data
. 我已使用以下代码从 Observations 实体中检索数据,该实体似乎运行没有任何问题,并且 observationsList 的计数是正确的。
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:@"Observations"];
NSError *error = nil;
observationList = [[NSArray alloc]init];
observationList = [self.managedObjectContext executeFetchRequest:fetchRequest error:&error];
但是,当我尝试使用数组访问数据时 - 例如:
NSLog(@"%@", [[observationList objectAtIndex:0] objectForKey:@"obsDate"]);
它抛出一个错误
reason: '-[Observations objectForKey:]: unrecognized selector
obsDate 存在于核心数据中。谁能看到我做错了什么?