如何调试Core Data Unresolved错误(null),(null)

时间:2013-09-09 14:24:05

标签: ios objective-c cocoa-touch core-data

当我尝试保存Core Data时,我进入控制台:

  

未解决的错误(null),(null)

- (void)saveInManagedObjectContext:(NSManagedObjectContext *)context {

    if (context == nil) {

        // Use default MOC
        context = self.managedObjectContext;

        NSError *error = nil;

        if ([context hasChanges] && ![context save:&error])
        {
            /*
             Replace this implementation with code to handle the error appropriately.

             abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
             */
            DLog(@"Unresolved error %@, %@", error, [error userInfo]);
            abort();
        }

    }
}

NSError对象为nil时,很难对其进行调试。

如何获取更多有用的信息,为什么保存操作不成功?

0 个答案:

没有答案