Core Data 为列名返回 null。
这是我在视图控制器中的代码
for (TaskyEntity *task in [mycoredata searchAllData]) {
NSLog(@"title: %@",task.title);
NSLog(@"i:%i ",i);
i++;
}
它的输出:
2013-03-17 19:31:08.462 tasky[2623:c07] title: (null)
2013-03-17 19:31:08.463 tasky[2623:c07] i:1
2013-03-17 19:31:08.464 tasky[2623:c07] title: (null)
2013-03-17 19:31:08.464 tasky[2623:c07] i:2
2013-03-17 19:31:08.465 tasky[2623:c07] title: (null)
2013-03-17 19:31:08.466 tasky[2623:c07] i:3
任务实体类:
-(NSArray *)searchAllData {
NSFetchRequest *request = [[NSFetchRequest alloc]init];
[request setEntity:entitydescription];
NSError * error=nil;
NSArray *matchData = [context executeFetchRequest:request error:&error];
return matchData;
}