开发者

Better illustrating error message for NSXMLParser

开发者 https://www.devze.com 2023-01-14 09:06 出处:网络
Now the user only get a error message like \"Error code 5\". NSString *errorString = [NSString stringWithFormat:@\"Error code %i\", [parseError code]];

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];
0

精彩评论

暂无评论...
验证码 换一张
取 消