知道如何在客户端处理电子标签吗?我们计划在我们的应用程序中使用来自服务器的带有图像的 eTag。
什么是 eTag,请参阅: http ://en.wikipedia.org/wiki/HTTP_ETag
知道如何在客户端处理电子标签吗?我们计划在我们的应用程序中使用来自服务器的带有图像的 eTag。
什么是 eTag,请参阅: http ://en.wikipedia.org/wiki/HTTP_ETag
Starting points for your study ...
NSMutableURLRequest
Here you can set eTag value for you request.
[self addValue:eTag forHTTPHeaderField:@"If-None-Match"];
This request is usable with NSURLConnection.
NSURLConnectionDelegate
Delegate of your NSURLConnection has method ...
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
... where response in your case is NSHTTPURLResponse
.
You should check response statusCode in another delegate's method ...
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
... status code 304 is received when remote object is not modified. If remote object is modified and eTag is supported, you can find it in [response allHeaderFields]
.