views:

26

answers:

0

I use NSURLConnection like this

  • (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse )response { if ( [response isKindOfClass:[NSHTTPURLResponse class]]) { int code = [(NSHTTPURLResponse)response statusCode]; } }

i get a response whose statusCode is 204,then i send another request,but all responses i received after it will return 204, howerver the tcpdump show that the server return 200. But after a minute, it will return 200.

I thought it might be something wrong about cache, howerver i set cachePolicy to NSURLRequestReloadIgnoringLocalCacheData and also i do [[NSURLCahce sharedCache] removeAllCachedResponses] before new request.

But it doesn't work. still i'll get 204 after the first 204, if i send the request after a minute, 200 will be get.

is it the cache's fault? what can I do next?

PS:after a 204 arrived, if i send another request, the response arrived immediately, seems that it haven't been sent.howerver, tcpdumps catchs the send.