Url Cache

Hi all, I have implemented a feature in my iOS application which checks the latest version available on App Store and if there is new update available it shows Pop to update the app.

I am using this url for checki <https://itunes.apple.com/lookup?bundleId=>

Issue: For some users this url returns old cached data which is previous version although new version is already live and i have verified this url directly via PostMan or other IDE.

Thanks for the post.

The root cause is caching, which is happening on many different levels: local device caching and server global caching as well as anything between them. Also please remember you might be hitting a different CDN node than your users as well.

By default, URLSession will cache HTTP responses. If a user's device recently checked the URL before your new version went live, their device will keep returning the old cached response without actually hitting servers or anything else in between. So it’s important to change the URLRequest.cachePolicy to ignore local cache and add a random timestamp to the URL to force to treat it as a brand-new request.

Hope this helps.

Albert  WWDR

Url Cache
 
 
Q