views:

51

answers:

3

So, I have a basic app for storing, searching, and manipulating data. Basic CRUD operations. In various places of my code where I'm storing or updating this data, I basically have this:

NSError *error;
if (![self.managedObjectContext save:&error]) {
  // TODO: Handle this error
  NSLog(@"Error while saving data %@, %@", error, [error userInfo]);
}

What do most people do, user-experience-wise, when these sorts of things come up?

The only thing that comes to mind is to just pop up some horrible UIAlertView with a vague message that something went wrong; not really sure how to recover these things.

For the sake of argument, lets assume my model has little to no validations, so the only errors that might occur would either be something horribly wrong or a programming problem.

Any good ideas on the user experience?

A: 

In a case like this, I think the best thing to do would be to present an alert to the user and quit the app.

eman
Any tips on wording? I put these in, and I ended up with lots of lame "The was an error saving your Widget; please try restarting the app". I hate that stuff, but I'm not sure what else to do?!
davetron5000
A: 

Short answer is that I have never had a save error occur in production. Normally I make these asserts and have them crash the app. This is to make sure I catch them during development.

If your application is well-written you should not have one of these occur when a user is running the application.

As for the text, it depends on your application and there is no general rule for them.

Marcus S. Zarra
+1  A: 

Jakob Nielsen has a few concise guidelines you might want to check out; out of everything he proposes, the one I strongly suggest you indicate in an error message that it's not the user's fault. From my own experience in user testing, most users believe they did something wrong when an error pops up, and this leads to frustration.

Maybe something like:

There was a problem saving: don't worry it's not your fault! If you restart the app, you can try again. But please contact [developer contact] and tell him the error was [short, memorable error code]

Mark Trapp