我已經在覈心數據中執行了保存操作,並且它已成功完成。它存儲數據。我也將數據提取到日誌中。這是我在日誌中獲取數據的代碼,但我不知道如何在TableView中獲取這些數據。從核心數據填充表格視圖
NSError *error;
DemoAppCoreDataAppDelegate *appdelegate = (DemoAppCoreDataAppDelegate *)[[UIApplication sharedApplication]delegate];
NSManagedObjectContext *context = [appdelegate managedObjectContext];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc]init];
NSEntityDescription *entity = [NSEntityDescription entityForName: @"Employee" inManagedObjectContext:context];
[fetchRequest setEntity:entity];
NSArray *fetchedobject = [context executeFetchRequest:fetchRequest error:&error];
tablearray = [[NSMutableArray alloc] initWithArray:fetchedobject copyItems:YES];
for (NSManagedObject *info in fetchedobject) {
NSLog(@ "%@",[info valueForKey:@"name"]);
}
[fetchRequest release];