我已经在Apple引用的示例代码中看到了如何处理Core Data错误.即:
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 %@, …Run Code Online (Sandbox Code Playgroud) 在我的应用程序的某些时候,我已经完成了这个exit(0)崩溃我的应用程序.但我还没弄清楚在执行时调用哪种方法.
我把消息放入:
(void)applicationWillTerminate:(UIApplication *)application
(void)applicationDidEnterBackground:(UIApplication *)application
Run Code Online (Sandbox Code Playgroud)
但这一切似乎都没有被召唤!什么方法在exit(0)完成时被调用?