1、WKWebView使用
需要实现代理WKNavigationDelegate,WKUIDelegate,WKScriptMessageHandler
//创建一个WKWebView的配置对象
WKWebViewConfiguration *configur = [[WKWebViewConfiguration alloc] init];
//设置configur对象的preferences属性的信息
WKPreferences *preferences = [[WKPreferences alloc] init];
configur.preferences = preferences;
//是否允许与js进行交互,默认是YES的,如果设置为NO,js的代码就不起作用了
preferences.javaScriptEnabled = YES;
WKUserContentController *userContentController = [[WKUserContentController alloc]init];
[userContentController addScriptMessageHandler:[[XLWeakScriptMessageDelegate alloc] initWithDelegate:self] name:@"IOSCallPhone"];