Sunday, February 14, 2010

Programmer - iPhone Core Data "Production" Error Handling

Programmer Question

Hi there,



I've seen in the example code supplied by Apple references to how you should handle Core Data errors. I.e:



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();
}


But never any examples of how you should implement it.



Does anyone have (or can point me in the direction of) some actual "production" code that illustrates the above method.



Thanks in advance,
Matt

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails