Is it possible to cache resources loaded in an iPhone UIWebView?

前端 未结 6 826
时光取名叫无心
时光取名叫无心 2020-12-04 18:36

I have a simple app loading a site optimized for the iPhone in a UIWebView.

Problem is, caching does not seem to work:

[webView loadRequ         


        
6条回答
  •  有刺的猬
    2020-12-04 19:13

    From https://github.com/phonegap/phonegap-iphone/issues/148:

    NSURLCache* cache = [NSURLCache sharedURLCache];
    [cache setMemoryCapacity:4 * 1024 * 1024];
    [cache setDiskCapacity:512*1024];
    
    [NSURLRequest requestWithURL:appURL
                     cachePolicy:NSURLRequestReturnCacheDataElseLoad
                 timeoutInterval:10.0];
    

提交回复
热议问题