And*_*ewO 5 iphone core-data abort
我的iPhone应用程序中有很多地方有这样的一行:
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();
}
Run Code Online (Sandbox Code Playgroud)
我对在生产应用程序中实际替换abort()的内容感到茫然.我不认为有任何简单的方法允许用户的设备将错误发送给您.这里的标准做法是什么?
我所做的取决于应用程序中发生的事情.如果可以回滚保存而不影响应用程序,则可以执行此操作.那将是非常罕见的.更有可能的是,您希望让用户知道他们的保存失败了.根据失败的原因,您可以提供再试一次或解释它无效的原因.
它主要取决于您的应用程序以及如何最好地为用户服务.
| 归档时间: |
|
| 查看次数: |
1355 次 |
| 最近记录: |