Simple question about NSURLConnection::initWithURL:delegate:
Simple question about NSURLConnection::initWithURL:delegate:
- Subject: Simple question about NSURLConnection::initWithURL:delegate:
- From: Richard <email@hidden>
- Date: Mon, 26 May 2008 13:41:50 -0700
In case my background might suggest some types of errors I might make: I have a strong programming background in C and Java and some experience in C++. I've done network programming in all three.
Now, my problem
I'm trying to get used to the networking API Apple provides so I
thought I'd try to write a simple wrapper around the NSURL* classes. It
works fine for synchronous page retrieval but it's not working for the
asynchronous bit and I can't seem to figure out what's going wrong.
calling code:
http://rafb.net/p/pKe8oB43.html
NSURLConnection wrapper code:
http://rafb.net/p/cv6eMC23.htmlconsole output:
http://rafb.net/p/C8vV7430.html
Take a look at the output from the NSLog statements (
http://rafb.net/p/uRyDcG38.html
). If you compare that to the ManagedConnection class and the logging
statements within you'll see that connection:didReceiveResponse: is not
called and that connection:willCacheResponse: is.
Checking the docs associated with NSURLConnection I find the following two statements:
"Zero or more connection:didReceiveResponse: messages will be sent to
the delegate before receiving a connection:didReceiveData: message. The
only case where connection:didReceiveResponse: is not sent to a
delegate is when the protocol implementation encounters an error before
a response could be created."
and
"Zero or one connection:willCacheResponse: messages will be sent to the
delegate after connection:didReceiveData: is sent but before a
connectionDidFinishLoading: message is sent."
To me this seems to mean that something is broken because not getting a
connection:didReceiveResponse: sounds like I should be getting an error
on the connection attempt. Also, the wording of
connection:willCacheResponse: implise that it only gets called after
connection:didReceiveData: which is not getting called for me.
Can anybody offer me a hand to figure out what's going wrong here? I'm running OSX
10.5.2.thanks
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden