user2273459
user2273459

Reputation: 35

If-Modified-Since request in iOS

I try to synchronise local data with server. Is it possible to use get "if-Modified-Since" request in IOS?

If-Modified-Since = "If-Modified-Since" ":" HTTP-date

Upvotes: 2

Views: 1915

Answers (1)

Mike Weller
Mike Weller

Reputation: 45598

You can set HTTP fields with an NSMutableURLRequest:

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setValue:@"Your string" forHTTPHeaderField:@"If-Modified-Since"];
// ...

You can then check the status code of the response and look specifically for 304 (Not Modified).

Upvotes: 5

Related Questions