On the server side, I set Cache-Control: max-age = 14400.
From my iOS client, I am setting up a generic AFHTTPSessionManager instance, for example:
+ (TKClient *)sharedInstance { static TKClient *instance = nil; static dispatch_once_t token; dispatch_once(&token, ^ { instance = [[TKClient alloc] initWithBaseURL:[NSURL URLWithString:kTKBaseUrl]]; [instance setRequestSerializer:[AFJSONRequestSerializer serializer]]; }); return instance;
And making my API calls like this:
- (void)listingsWithParams:(NSDictionary *)params completion:(void (^)(NSMutableArray *listings, NSError *error))completion { [self GET:@"api/listings" parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
I have verified that the Cache-Control header is correctly returned from the server side for this list. However, the call accesses the server each time, and it is clearly not cached. Any idea what could be the problem?
Do I need to configure something else on the iOS side or somehow change the Cache-Control headers? Thanks!
source share