【问题标题】:UIWebView and NSUrlCacheUIWebView 和 NSUrlCache
【发布时间】:2010-07-02 23:13:23
【问题描述】:

我有一个 NSURLCache,它只记录 cachedResponseForRequest 和 storeCachedResponse 调用。

UIWebView 似乎会为每个请求调用 cachedResponseForRequest,但 storeCachedResponse 只会为顶级页面调用,即不会为任何 css/js/etc 调用。在 html 中指定。

有什么理由可以(不)发生这种情况吗?

我在 3.2 ipad 模拟器和设备上观察到这一点。

【问题讨论】:

    标签: iphone ipad uiwebview nsurlcache


    【解决方案1】:

    据我了解,WebKit 使用私有机制来获取和存储缓存中的资产。这些是前面提到的方法:

    - (CFCachedURLResponse*)_nscfBridgeURLCacheCopyResponseForRequest:(CFURLRequest*)request;
    - (void)_nscfBridgeURLCacheStoreCachedResponse:(CFCachedURLResponse*)cachedResponse forRequest:(CFURLRequest*)request;
    

    请注意,它们使用的是 Core Foundation 对象。

    【讨论】:

      猜你喜欢
      • 2012-02-14
      • 2011-01-06
      • 1970-01-01
      • 1970-01-01
      • 2012-02-20
      • 1970-01-01
      • 2014-03-06
      • 1970-01-01
      • 2013-04-23
      相关资源
      最近更新 更多