4

在我的 phonegap 应用程序中,我具有下载新的 JS 和 HTML 文件并更新到 www 文件夹的功能。更新后,我需要清除旧缓存的 js 和 html 文件(不杀死应用程序并重新启动)。在 Android 中,我调用 DroidGap.appView.clearCache(true) 来执行此操作。但是我在iOS中没有找到任何类似的方法。我尝试了几种方法:

删除共享缓存

[[NSURLCache sharedURLCache] removeAllCachedResponses];
NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];
[NSURLCache setSharedURLCache:sharedCache];

清除 ASIHTTPRequest 的缓存(我使用这个库)

[[ASIDownloadCache sharedCache] clearCachedResponsesForStoragePolicy:ASICachePermanentlyCacheStoragePolicy];

但他们都不能解决这个问题。任何人都可以帮助我吗?我非常感谢您能提供的任何帮助。

4

0 回答 0