I am working with CoreData app, As we know while saving a entity or deleting a entity from context we always make this check
NSError *error;
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.
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
}
I too in my app at many places have this code, the commenting by apple says " 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.
I am not able to figure few things
1) What message to show to user?
2) Shall I ask the user to send me the error report?
3) Should I use the abort?
1) Entirely up to you. Be sure to explain simply that there was a problem and that their data could not be saved. This kind of situation should be very rare.
2) Also up to you, but most users will not know how to do that. It would help if you implemented logic to email the error to you inside the app.
Responsible 3) Absolutely not (what is unclear about "You should not use this function in a shipping application"?). A save failure will not make your application unable to continue since the data will still be available in memory.
Alternate 3) Entirely up to you. If the app review team catches it, you will be rejected. This save failure is very unlikely to happen outside of development though.