1

I got an Exception

Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo=0x1fd68a20 {NSErrorFailingURLStringKey=http://mac-mini.local/~user/restcon/auth?username=&password=, NSErrorFailingURLKey=http://mac-mini.local/~user/restcon/auth?username=&password=, NSLocalizedDescription=The request timed out., NSUnderlyingError=0x1fd25730 "The request timed out."}

How can I get the NSLocalizedDescription?

If I 'po 0x1fd68a20' in debugger, I can get the NSDictionary I want. But the [exception userInfo] returns me nil.

kaala
  • 536
  • 1
  • 5
  • 15

1 Answers1

2

Assuming your exception is in an object of type NSException, try

NSString *errorDescription = [exception.error.userInfo valueForKey:NSLocalizedDescriptionKey].
Jon Madison
  • 435
  • 6
  • 16
  • 1
    Thank you, I almost forgot this question. actually, you are correct. the returned object is not NSException, it's a NSError, I access the wrong variable. – kaala Jun 18 '14 at 10:00
  • Are you getting the localised string for "The request timed out" NSURLErrorDomain error ? – nithinbhaktha May 29 '19 at 11:25