ios - Unwanted caching a GET request with AFNetworking -
i have situation here, use rest api afnetworking retrieve specific resource (get request) our backend. when check backend browser result 165 in 1 specific device (one specific iphone 6 plus) result 5, in other device retrieve 165 correct answer. think cached result on device doesn't found out on specific device.
i deleted application , installed again , works wrong again, nsurlcache
isn't problem either
code use retrieve data backend, works fine other devices, doesn't work on specific device. (by way use same username , password check on devices , browsers) isn't case.
afhttprequestoperationmanager* manager = [afhttprequestoperationmanager manager]; manager.requestserializer = [afjsonrequestserializer serializer]; [manager.requestserializer setvalue:[[nsuserdefaults standarduserdefaults] valueforkey:token_id_key] forhttpheaderfield:token_http_header_name]; [manager get:[nsstring stringwithformat:@"%@%@", base_url, profile_url] parameters:nil success:^(afhttprequestoperation* operation, id responseobject) { nslog(@"profile info request accepted response : %@",responseobject); profile = [[profile alloc] initwithdictionary:responseobject]; [self.tableview reloaddata]; } failure:^(afhttprequestoperation* operation, nserror* error) { nslog(@"profile info request failed eroor : %@" , [error localizeddescription]) ; }];
if find out nothing solve problem can add current time @ end of url. happened me , added url it's new request.
long currenttime = (long)cfabsolutetimegetcurrent(); nsstring *urlstring = [nsstring stringwithformat:@"%@%@?%ld", base_url, profile_url, currenttime];
this workaround. hope helps
Comments
Post a Comment