最佳答案
我在苹果提供的示例代码中看到过如何处理核心数据错误,比如:
NSError *error = nil;
if (![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. If it is not possible to recover from the error, display an alert panel that instructs the user to quit the application by pressing the Home button.
*/
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
}
但是从来没有任何例子说明 应该是如何实现它的。
是否有人拥有(或者可以告诉我)一些说明上述方法的实际“生产”代码。
先说声谢谢, 马特