在 UITableView 的提交中,我使用以下代码删除了一个对象:
[_context deleteObject:[_StudiessList objectAtIndex:indexPath.row]];
NSError *error;
if (![_context save:&error]) {
// Handle error
NSLog(@"Unresolved error series %@, %@", error, [error userInfo]);
}
[self LoadData]; // bad access fire here
LoadData
重新填充表格视图的功能在哪里
它的代码是:
iPaxeraAppDelegate *appDelegate = (iPaxeraAppDelegate *)[[UIApplication sharedApplication] delegate];
self.context = appDelegate.managedObjectContext;
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription
entityForName:@"Studies" inManagedObjectContext:_context];
[fetchRequest setEntity:entity];
NSArray *sortDescriptors = [NSArray arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"StudyDate" ascending:YES] autorelease]];
[fetchRequest setSortDescriptors:sortDescriptors];
NSError *error;
@try {
// error done here exactly at fetch
self.StudiessList = [_context executeFetchRequest:fetchRequest error:&error];
}
@catch (NSException * e) {
NSLog(e);
}
[fetchRequest release];
[StudiessList retain];
LoadData
崩溃executeFetchRequest: