objective-cnsstringnserror

Returning an NSString from an NSError


I am using the NSURLRequest class in my iPhone app, and the method that calls it returns an NSString which is great for when the connection goes through ok, but the issue is I need to convert the NSError into an NSString so I can either return it back or run some if() statements on it.

Any ideas? :)


Solution

  • -[NSError localizedDescription].

    (Also, every ObjC object inherited from NSObject implements -description which returns an NSString.)