views:

26

answers:

1

Hi,

Now the user only get a error message like "Error code 5".

NSString *errorString = [NSString stringWithFormat:@"Error code %i", [parseError code]];

UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:@"Error loading content" message:errorString delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[errorAlert show];

So the NSXMLParserError code is not enough for me. I rather would like something like "NSXMLParserPrematureDocumentEndError" or "The document ended unexpectedly."

Is there an easy way to do this?

Cheers

A: 

Check NSError's localizedDescription, localizedFailureReason etc etc methods in NSError class reference

NSString *errorString = [parserError localizedDescription];
lukya
testing
well if you can list down all the errors from the NSXMLParserErrorDomain which you specifically want to describe to the user, you can write a switch case comparing those errors from the Parser Error Constants, and then throw a general error message for the remaining errors in default..
lukya
thanks, I also though about this. I hoped there is an easier way or an existing solution.
testing