WebViewJavascriptBridge

1.load加载 ,去本地查找html路径方式

NSString* htmlPath = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];//这种方式不会去工程中蓝色folder中查找html
NSString *strRoot = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"deploy"];
//strRoot=/Users/liuwei/Library/Developer/CoreSimulator/Devices/3AD005A6-3D89-415E-84E6-797021F9A35E/data/Containers/Bundle/Application/C4379CFE-A113-480C-AF45-BDF7F8645EC3/WKWebView加载本地html.app/deploy
 

2.[NSURL fileURLWithPath:htmlPath] 和 [NSURL URLWithString:htmlPath]的区别

NSLog(@"htmlPath--%@",htmlPath);
NSLog(@"fileURLWithPath--%@,URLWithString--%@",[NSURL fileURLWithPath:htmlPath],[NSURL URLWithString:htmlPath]);
//htmlPath--/var/containers/Bundle/Application/0F25B57D-11D1-414D-B8CF-9CF7B66B0D59/WKWebView加载本地html.app/deploy/index.html
//fileURLWithPath--file:///var/containers/Bundle/Application/0F25B57D-11D1-414D-B8CF-9CF7B66B0D59/WKWebView%E5%8A%A0%E8%BD%BD%E6%9C%AC%E5%9C%B0html.app/deploy/index.html,URLWithString--(null)

3.有人说WKWebView加载本地html,9.0以前不能用loadRequest直接load, 需要先拷贝到沙盒文件夹里去。 http://www.jianshu.com/p/ccb421c85b2e

但是我发现仍然可以加载。不管NSURL用的是fileURLWithPath还是URLWithString, 用 [webView loadRequest:[NSURLRequest requestWithURL:fileURL]];

都能加载出来。

4.断网情况下,UIWebView是加载不了内容的, 除非加入一些3方插件,处理缓存。如JWCacheURLProtocol
我们项目 ,h5做了manfest缓存, 断网情况下仍然可以加载部分内容, 不需要用3方插件做任何其他缓存处理。

5.缓存策略那个超时时间设置是没有作用的。

未完...

最新文章

  1. SwipeMenuListView在ScrollView里上下滑动导致菜单不能显示完全的bug解决方法
  2. SQL 语句格式
  3. vmware 安装 macos
  4. 重新想象 Windows 8 Store Apps (45) - 多线程之异步编程: IAsyncAction, IAsyncOperation, IAsyncActionWithProgress, IAsyncOperationWithProgress
  5. IOS应用程序生命周期的AppDelegate详解
  6. gdb调试大全
  7. React组件生命周期过程说明【转】
  8. 执行curl -sSL 提示curl: (35) SSL connect error
  9. MongoDB学习笔记05
  10. haproxy image跳转 haproxy匹配 匹配到了就停止,不会继续往下匹配
  11. ajax的get与post提交方式
  12. qt数据库多线程问题的解决(QSqlDatabase只能在创建它的线程中使用)
  13. javascript笔记整理(正则)
  14. c语言,enum
  15. flume日志采集
  16. Android studio导入eclipse项目(亲测)
  17. Pycharm常用的使用方法
  18. 基本 SQL 之增删改查(二)
  19. if 嵌套if 的先后顺序的区别 (自测)
  20. Mockito各场景使用介绍

热门文章

  1. awk调用系统命令
  2. Vue知识整理6:JavaScript表达式
  3. B-/B+树 MySQL索引结构
  4. Numpy 基础函数
  5. LeetCode——707 设计链表
  6. 简单DP入门(一) 数字三角形
  7. vue中的provide/inject讲解
  8. 事件 on emit off 封装
  9. go工具链
  10. HDU 1069 Monkey and Banana dp 题解