Is there any ways to systematically display the errors when did fail delegate is called in NSURLConnection delegate method?Is there any helper methods to find the associated error with error number returned by the delegate?
Asked
Active
Viewed 84 times
1 Answers
1
Read about NSError
in Apple's documentation. It has certain properties and methods to give details of error/failures. Once you're good with this you can access the error object provided in the delegate method to know about the NSURLConnection failure.
Also, you can use object.description
or object.debugDescription
If you want to see the common errors (i.e. understandable by laymen ), then just print error.localizedDescription
. It will print something very simple as "Internet not available" etc. instead of giving you error codes, etc.

CodenameLambda1
- 1,299
- 7
- 17
-
I need to print custom error message with the type of associated message,but as i see the list of errors are so large to be used inside switch statement.@ CodenameLambda1 Can you suggest the common errors? – sams58 Aug 02 '13 at 09:28
-
Yes, if you want to see the common errors (i.e. understandable by laymen ), then just print error.localizedDescription. It will print something very simple as "Internet not available" etc. instead of giving you error codes, etc. – CodenameLambda1 Aug 02 '13 at 09:36
-
I need to take actions based on connectivity problems such as wi-fi not available or download failure,authentication failed etc... – sams58 Aug 02 '13 at 09:43