正在下载plist,但似乎每次都获得一个缓存的版本 [英] Downloading plist, but seem to get a cached version every time

查看:39
本文介绍了正在下载plist,但似乎每次都获得一个缓存的版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在服务器上有一个为应用程序提供的plist.在启动时,该应用程序会下载plist并检查一些内容,然后再继续启动.

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.

我遇到的问题是,当我更新服务器上的plist时,该应用似乎每次都下载旧版本.至少从控制台日志中,我看不到我在plist中所做的更新.我正在更新一个整数以检查并与已安装的文件进行比较,但是该整数不会更改为新的文件.

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.

我不确定我的服务器(某些托管公司)是否在提供缓存版本-在浏览器中或通过FTP查看文件时,是否可以使用新的更新整数?或者问题是否出在应用程序上?我正在使用AFNetworking,是否存在一些疯狂的缓存?

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?

任何建议都值得赞赏.

更新:我只是试图删除服务器上的文件,然后重新启动应用程序,控制台仍会输出文件...似乎在应用程序中有些奇怪的缓存了,不是吗?

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?

推荐答案

我还没有使用过AFNetworking(还!),但不久前我使用NSURLRequest遇到了类似的问题,我发现使用创建请求requestWithURL:cachePolicy:timeoutInterval:并指定一个缓存策略,而不仅仅是 requestWithURL:解决了我的问题.

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.

例如 NSURLRequest * urlRequest = [NSURLRequest requestWithURL:downloadURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60];

我希望这会有所帮助.

这篇关于正在下载plist,但似乎每次都获得一个缓存的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆