Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling eTags on iPhone

Any idea how to handle eTags at client side? We are planning to use eTags with images in our application which are coming from the server.

For what is eTag please see this: http://en.wikipedia.org/wiki/HTTP_ETag

like image 998
Abhinav Avatar asked Feb 17 '11 07:02

Abhinav


People also ask

How do you use AirTag on iPhone?

Open the Find My app, then tap the Items tab. Choose the AirTag you want to locate, then tap Find . Follow the onscreen instructions and move around the space until your iPhone connects to your AirTag. Your iPhone displays the distance and direction to your AirTag.

Can you track someone with AirTags?

Anyone who is alerted to the presence of an unknown AirTag, either through Apple's notification system or by using Tracker Detect, can trigger an audible chime to help them locate the device.

How far does AirTag work?

What is the distance an individual AirTag can track with Bluetooth? Apple has not specified the exact Bluetooth range of an AirTag, but it's believed that each AirTag supports Bluetooth 5.0 (same as the latest iPhones), which means it should be trackable within 800 feet.

What is Etags caching?

ETag is used for efficient browser cache in order to decrease bandwidth consumption. If a website uses ETag for its web page resources, the server won't need to send a full response for every request if the resources don't change. Lastly, Etags prevents “mid-air collisions” or “simultaneous updates of resources”.


1 Answers

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].

like image 178
zrzka Avatar answered Sep 27 '22 17:09

zrzka