cocoa - Receive Cached Data after http status code 204 recevied -
I use
- ( void) connection: (NSURLConnection *) connection didReceiveResponse: (NSURLResponse *) response {if ([response isKindOfClass: [NSHTTPURLResponse class]]) {int code = [(NSHTTPURLResponse *) reaction statusCode]; }}
I send a response that meets statusCode is 204, then I have another request, but 204 will come back after all the responses I received, tcpdump show howerver server Return 200 but after one minute, this 200 will return.
I thought it might be wrong about some cash, Howerver I do and I set cachePolicy the NSURLRequestReloadIgnoringLocalCacheData
But it does not work. Still I will post 204 before 204, if I send the request after a minute, there will be 200.
Is this a mistake of cash? What can I do next?
PS: After the arrival of a 204, if I send a request immediate reply came, it seems that it has not been sent. Verwer sends TCPDs.
Take a look at the NSURLRequest class method "requestWithURL: cachePolicy: timeoutInterval:". There you can set a cash policy as an NSURLRequestCachePolicy value, for example, NSURLRequestReloadIgnoringLocalCacheData This will not ignore any cache of locally stored requests
NSURLRequest * theRequest = [NSURLRequest requestWithURL: theURL cachePolicy: NSURLRequestReloadIgnoringLocalCacheData timeoutInterval: 20.0f];
Comments
Post a Comment