In my iOS app written in Swift 2.1, I use a WKWebView to load a HTML string which is loaded from a wordpress blog using a JSON parser.
I implemented the delegate method
and set the navigation delegate of the WKWebView to self in order to handle link presses.
Now, when I open the ViewController which contains the WKWebView, this delegate method gets called once, which is the behaviour you would expect on load of the webView - so the delegate seems to be set properly.
My problem now is that most time the links which the webView contains are <strong>not clickable</strong>. You would usually expect that a <strong>gray background appears</strong>, when you a press a link as you can see in the image below. But most time, when I press a link, the gray background doesn't appear, so when I touch up, the delegate method doesn't get called. This problem certainly doesn't have to do something with a misconfiguration of the
, since sometimes the link selection works properly (about 10 %).
<a href=" " rel="nofollow noreferrer"><img src=" " alt="appearance of links when you select them"></a>
Do you have any idea why links are randomly sometimes not clickable, and sometimes clickable (10 % of the cases)?
<hr>
I implemented the delegate method
Code:
func webView(webView: WKWebView, decidePolicyForNavigationAction navigationAction: WKNavigationAction, decisionHandler: (WKNavigationActionPolicy) -> Void) {
Now, when I open the ViewController which contains the WKWebView, this delegate method gets called once, which is the behaviour you would expect on load of the webView - so the delegate seems to be set properly.
My problem now is that most time the links which the webView contains are <strong>not clickable</strong>. You would usually expect that a <strong>gray background appears</strong>, when you a press a link as you can see in the image below. But most time, when I press a link, the gray background doesn't appear, so when I touch up, the delegate method doesn't get called. This problem certainly doesn't have to do something with a misconfiguration of the
Code:
WKNavigationDelegate
<a href=" " rel="nofollow noreferrer"><img src=" " alt="appearance of links when you select them"></a>
Do you have any idea why links are randomly sometimes not clickable, and sometimes clickable (10 % of the cases)?
<hr>