【发布时间】:2013-05-06 08:29:31
【问题描述】:
测试人员遇到了一种情况,即(iOS)应用程序在启动时由于无法实现的核心数据故障(抛出NSObjectInaccessibleException)而崩溃。因为应用程序做的第一件事是用托管对象填充表格视图,所以应用程序在启动时会继续崩溃。
问题很简单。 我该如何解决这个问题,以便测试人员至少可以继续使用应用程序而不会丢失数据?
为了为这个问题提供更多背景信息,当如下所示配置表格视图单元格时,应用程序会崩溃。这个方法是从tableView:cellForRowAtIndexPath:调用的。
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath {
// Fetch Store
CCDStore *store = [self.fetchedResultsController objectAtIndexPath:indexPath];
// Configure Cell
[cell.textLabel setText:[store name]]; // Exception is thrown due to Core Data fault
[cell.detailTextLabel setText:[store numberOfLists]];
}
因为我无权访问设备或(SQLite)数据库,我猜测是部分数据库包含损坏的数据导致故障。
【问题讨论】:
标签: ios core-data exception-handling