Question

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.

Was it helpful?

Solution

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

NSString *errorDescription = [exception.error.userInfo valueForKey:NSLocalizedDescriptionKey].
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top