Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

shadowfaux

macrumors newbie
Original poster
May 19, 2008
8
0
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.

Can somebody take a look at it and see if you can identify what I'm screwing up?

calling code: http://rafb.net/p/pKe8oB43.html
NSURLConnection wrapper code: http://rafb.net/p/cv6eMC23.html

NSLog output: http://rafb.net/p/uRyDcG38.html

thanks
-sf
 

shadowfaux

macrumors newbie
Original poster
May 19, 2008
8
0
You say it isn't working; what are the symptoms?

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.

Does that make a bit more sense? sorry I wasn't more clear up above. If it's still unclear what's got me confused feel free to ask, I'm at wits end here and pretty sure it's some newbie mistake that's staring me in the face =/
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.