Downloading plist, but seem to get a cached version every time

╄→尐↘猪︶ㄣ 提交于 2019-12-11 05:19:51

问题


I have a plist on my server that I provide for an app. On launch the app downloads the plist and checks a few things before continuing with the launch.

The issue I am running into is that when I update the plist on my server, the app seems to download the old version every time. At least from the console log, I am not seeing the updates I did in the plist. I am updating an integer to check and compare with an installed file, but the integer doesn't change to the new one.

I am not sure whether my server (some hosting company) is serving a cached version - when viewing the file in a browser or through FTP, it's fine and is the new updated integer - or whether the issues is with the app? I am using AFNetworking, is there some crazy caching going on?

Any advice is much appreciated.

UPDATE: I just tried to delete the file on the server and re-launch the app and the console still outputs the file... Seems so be some weird caching in the app, no?


回答1:


I haven't used AFNetworking (yet!) but I ran into a similar issue a while back using NSURLRequest and I found that creating the request using requestWithURL:cachePolicy:timeoutInterval: and specifying a cache policy rather than just requestWithURL: solved my problem.

e.g. NSURLRequest *urlRequest = [NSURLRequest requestWithURL:downloadURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60];

I hope this helps.



来源:https://stackoverflow.com/questions/11235883/downloading-plist-but-seem-to-get-a-cached-version-every-time

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!