【发布时间】:2012-01-03 23:28:22
【问题描述】:
我在我的应用程序中使用核心数据。当我用[context deleteObject:obj] 删除对象时,对象不会只删除空字段。如何永久删除对象?提前致谢。我使用表格视图,当这个视图填充了核心数据中的数据时,有空行被删除了对象。这是代码:
LNAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
self.context = [appDelegate managedObjectContext];
self.accounts = [[NSArray alloc] init];
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription
entityForName:@"Accounts" inManagedObjectContext:self.context];
[fetchRequest setEntity:entity];
NSError *error;
self.accounts = [self.context executeFetchRequest:fetchRequest error:&error];
【问题讨论】:
-
什么意思,只有空字段?您使用哪种 UI 来显示这些对象?这里需要更多信息。
-
您是否使用获取的结果控制器来处理表格视图的填充/更新?
-
@PhilippeSabourin 你可以在我的帖子中看到代码