我一直在尝试将WKWebView集成为UIViewController中另一个webview的子视图.我已经能够加载内容并与swift和javascript正确通信.但是,没有任何数据操作的HTML内容的加载时间大约需要2秒.
我还测试了加载WKWebView只是一个空的HTML体,没有任何脚本加载.这仍然需要600毫秒才能加载.
viewDidLoad和webView(webView:WKWebView,didFinishNavigation导航:WKNavigation!)之间的差异时间是600毫秒,即使HTML包含空体.
ViewController的viewDidLoad函数
override func viewDidLoad() {
NSLog("started - %@.%@", String(self.dynamicType), __FUNCTION__)
super.viewDidLoad()
let wkConfiguration: WKWebViewConfiguration = WKWebViewConfiguration()
let userController: WKUserContentController = WKUserContentController()
wkConfiguration.userContentController = userController
wkConfiguration.processPool = VCWKWebView.wkProcess
self.wkWebView = VCWKWebView(frame: self.webView.bounds,configuration: wkConfiguration)
if let wkWebView = self.wkWebView {
self.webView.addSubview(wkWebView)
wkWebView.translatesAutoresizingMaskIntoConstraints = false
let height = NSLayoutConstraint(item: wkWebView, attribute: .Height, relatedBy: .Equal, toItem: self.webView, attribute: .Height, multiplier: 1, constant: 0)
let width = NSLayoutConstraint(item: wkWebView, attribute: .Width, relatedBy: .Equal, toItem: self.webView, attribute: .Width, multiplier: 1, …Run Code Online (Sandbox Code Playgroud) 我是 chrome 扩展的新手。是否可以通过手动(javascript)或使用清单配置向 chrome 扩展提供麦克风访问权限。
我已通过下载 twilio.js 成功包含 twilio,并将协议更改为“https”,以便在 chrome 扩展的 background.html 中使用。
Manifest.js 字段如下:
"permissions":["http://*/*", "https://*/*", "*://mail.google.com/*", "storage", "unlimitedStorage", "contextMenus", "cookies", "tabs", "notifications", "activeTab", "background","identity", "*://*.twilio.com/*"],
"content_security_policy": "script-src 'self' 'unsafe-eval' https://apis.google.com https://*.twilio.com; object-src 'self' https://*.twilio.com",
Run Code Online (Sandbox Code Playgroud)
现在,当分机使用 twilio 拨打/接听电话并接受连接时。它从 Twilio.Device.error 方法抛出错误,如下所示
error.message is **User denied access to microphone**.
Run Code Online (Sandbox Code Playgroud)
有人可以帮我解决这个错误吗?