Better illustrating error message for NSXMLParser
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];
S开发者_C百科o 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
Check NSError's localizedDescription
, localizedFailureReason
etc etc methods in NSError class reference
NSString *errorString = [parserError localizedDescription];
精彩评论