Re: NSURLConnection timeout -- what happens?
Re: NSURLConnection timeout -- what happens?
- Subject: Re: NSURLConnection timeout -- what happens?
- From: Stuart Malin <email@hidden>
- Date: Fri, 16 Oct 2009 09:30:29 -0400
On Oct 15, 2009, at 3:59 PM, Jens Alfke wrote:
On Oct 15, 2009, at 11:44 AM, Stuart Malin wrote:
I have looked through the NSURLConnection class reference, the
NSURLRequest class reference, the URL Loading System guide, queried
Google, searched mailing list archives, and even looked through
NSURLConnection.h, but can not find documentation about what
happens when an NSURLConnection times out. I presume that -- for
the asynchronous case -- the invoker's -
connection:didFailWithError: selector will be messaged. Is this so?
Where is that defined?
I think so, but I don't remember for sure. Why not try it? Set a
timeout of 0.1 sec and send a request to a slow server.
(shhepishly): good suggestion. Have done so: yes, an error is the
result with code 1001, which is defined in NSURLError.h as
NSURLErrorTimedOut
But I haven't been able to find any documentation of what the
possible errors are, and what the data would be for those reported
failures.
NSURLError.h.
Sure enough -- there they are.
But in practice you can sometimes get errors from other domains too,
especially if SSL is involved.
Well, logging will again be my friend :-)
The URL Loading System guide has an example that uses the key
"NSErrorFailingURLStringKey" to access a value from the error
object's userInfo dictionary. Where might other such keys be defined?
Tip: To see where a symbol is defined, hold down Command and double-
click it. If you'd done that with that key, it would have taken you
to NSURLError.h and answered part of your question.
Ah, I hadn't tried copying that symbol from the docs to Xcode in order
to search for its definition -- that's a good idea that I will hold
for the future.
Also, thanks for the Command-double-click tip -- I had been doing
Option-click and then selecting "Jump to definition" from the
contextual menu.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden