我正在使用 WKWebView
并设置了 WKNavigationDelegate
方法,一切看起来都很好。 delegate
方法按应有的方式响应,但不是我希望的 100%。
有一些特定的广告
是不可点击的。
通过说 not Clickable
我的意思是
`func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void)`
没有着火。
并且有一个 url 的观察者至少可以看到这是什么类型或 URL
这仍然没有从那里得到结果。
mainWebView.addObserver(self, forKeyPath: #keyPath(WKWebView.url), options: .new, context: nil)
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if keyPath == "estimatedProgress"{
progressBar.progress = Float(mainWebView.estimatedProgress)
print(Float(mainWebView.estimatedProgress))
}
if keyPath == #keyPath(WKWebView.url){
print(mainWebView.url?.absoluteString)
}
}
我唯一得到的是来自控制台的
[Accessibility] WKContentView[@] set up: @ pid: @ MACH_PORT
任何想法.....或有类似问题的人?
谢谢
你应该像下面这样注册一个处理程序:
[configuration.userContentController addScriptMessageHandler:self name"yourhandlerName"];
关于ios - 单击广告时,WKWebView 没有响应。控制台消息 : [Accessibility] WKContentView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53389008/
欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) | Powered by Discuz! X3.4 |