I used the following documention : http://nshipster.com/nsurlcache/and https://developer.apple.com/reference/foundation/urlcachelet url = NSURL(string: load_url1)let request = NSURLRequest(url: url as! URL,cachePolicy: NSURLRequest.CachePolicy.returnCacheDataElseLoad, timeoutInterval: 60)self.webView.loadRequest(request as URLRequest);任何人以前都实现过此功能.请提供一些演示代码,因为这是我第一次尝试缓存Has anyone implemented this before. Please provide some demo code as this is my first attempt on cache推荐答案只需使用let url = URL(string: urlString)var urlRequest = URLRequest(url: url!)urlRequest.cachePolicy = .returnCacheDataElseLoadwebView.loadRequest(urlRequest) 这篇关于如何在Swift 3中使用UIWebview在缓存中保存动态网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-28 10:50