connectionDidFinishLoading is not invoked immediately
connectionDidFinishLoading is not invoked immediately
- Subject: connectionDidFinishLoading is not invoked immediately
- From: ico <email@hidden>
- Date: Thu, 30 Dec 2010 00:37:39 +0800
Greeting, everyone
I have a strange problem with my NSURLConnection that I couldn't figure out.
My app will call a webservice to load data. Every time I send the request,
the method connection:didReceiveData: is invoked very quick,
and I put a NSLog statement inside this method, I can see that the data I
receive is just the same as shown in HTTP header field
Content-Length. So there should be no more data need to be received. In
fact, connection:didReceiveData is not invoked any more. if
it does, I would see more output from the NSLog() inside that method, but I
just see it exactly once as I expected. However,
my connectionDidFinishLoading is invoked exactly 1 minute later every time.
Not immediately or very soon after the didReceivedData
method.
Also, if my program don't make the webservice call probably, that is the
server return error message, it is quick. I use my program to
call another webservice which is public and free on the web, I got the
result very quick as well.
Now I wonder how NSURLConnection judge if data is received completed and
then call the connectionDidFinishLoading method.
Something like a '\0' to indicate the data is finish transferring? Or just
compare the content length in the HTTP header and the
bytes are received? If it is judge by '\0', the server side does not send
this byte so my program wait until it is timeout internally
(that's why it delays exactly 1 minute to call connectionDidFinishLoading
every time?) Just guessing.
Any information would be appreciated. Thanks.
--
==========================
Life isn't about finding yourself.
Life is about creating yourself.
_______________________________________________
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