WKWebView-填坑总结

  1. 先理解一下H5跨平台存在的意义:https://zhuanlan.zhihu.com/p/22240501
  2. WKWebView JS和原生的互调-通过图片服用,效果比文字更佳:https://www.zybuluo.com/Sweetfish/note/501575
  3. 看个例子感受一下:http://movii.github.io/blog/2017/04/17/iOS-and-JavaScript-1-UIWebVIew/
  4. 避免循环引用:https://www.jianshu.com/p/3cc26c48b7e7
  5. 缓存的问题:http://larrycode.cc/index.php/archives/54/
  6. 看到的其他的坑,存放备用一下:https://www.jianshu.com/p/9513d101e582

  PS:

  缓存这样写更简单:

 if([[UIDevice currentDevice].systemVersion floatValue] >= 9.0){
        NSSet *websiteDataTypes = [WKWebsiteDataStore allWebsiteDataTypes];
        
        // Date from
        
        NSDate *dateFrom = [NSDate dateWithTimeIntervalSince1970:0];
        
        // Execute
        
        [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:websiteDataTypes modifiedSince:dateFrom completionHandler:^{
            
           // Done
            
        }];
    }
原文地址:https://www.cnblogs.com/HackHer/p/8278007.html