WKWebView tapping on a ad doesn't fire delegate method
up vote
0
down vote
favorite
I am using a WKWebView
and I have the delegate methods for navigation (request/response) and everything works as it should. For some reason, there are some ads that the function doesn't fire at all. Any idea why? I can't even check the URL to see what is happening.
I get only WKContentView[@] set up: @ pid: @ MACH_PORT
and on the simulator if get a pop-up menu with title :
JavaScript and options : open / cancel
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void)
can I use something in configure?
Thanks
ios swift wkwebview
add a comment |
up vote
0
down vote
favorite
I am using a WKWebView
and I have the delegate methods for navigation (request/response) and everything works as it should. For some reason, there are some ads that the function doesn't fire at all. Any idea why? I can't even check the URL to see what is happening.
I get only WKContentView[@] set up: @ pid: @ MACH_PORT
and on the simulator if get a pop-up menu with title :
JavaScript and options : open / cancel
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void)
can I use something in configure?
Thanks
ios swift wkwebview
You can add observerwebView.addObserver(self, forKeyPath: "URL", options: [.new, .old], context: nil)
and thenoverride func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {print(change?[.newKey],change?[.oldKey])}
– canister_exister
Nov 19 at 14:41
it doesn't get triggered the observer for some reason and I tried different solutions to make it triggered
– P S
Nov 20 at 8:00
@canister_exister I managed to get the url with a similar solution so thanks for the help man. Now I just have to figure out why it is not firing the delegate method.
– P S
Nov 20 at 8:11
decidePolicyFor not always working for redirects
– canister_exister
Nov 20 at 14:49
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am using a WKWebView
and I have the delegate methods for navigation (request/response) and everything works as it should. For some reason, there are some ads that the function doesn't fire at all. Any idea why? I can't even check the URL to see what is happening.
I get only WKContentView[@] set up: @ pid: @ MACH_PORT
and on the simulator if get a pop-up menu with title :
JavaScript and options : open / cancel
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void)
can I use something in configure?
Thanks
ios swift wkwebview
I am using a WKWebView
and I have the delegate methods for navigation (request/response) and everything works as it should. For some reason, there are some ads that the function doesn't fire at all. Any idea why? I can't even check the URL to see what is happening.
I get only WKContentView[@] set up: @ pid: @ MACH_PORT
and on the simulator if get a pop-up menu with title :
JavaScript and options : open / cancel
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void)
can I use something in configure?
Thanks
ios swift wkwebview
ios swift wkwebview
edited Nov 19 at 14:40
asked Nov 19 at 14:19
P S
959
959
You can add observerwebView.addObserver(self, forKeyPath: "URL", options: [.new, .old], context: nil)
and thenoverride func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {print(change?[.newKey],change?[.oldKey])}
– canister_exister
Nov 19 at 14:41
it doesn't get triggered the observer for some reason and I tried different solutions to make it triggered
– P S
Nov 20 at 8:00
@canister_exister I managed to get the url with a similar solution so thanks for the help man. Now I just have to figure out why it is not firing the delegate method.
– P S
Nov 20 at 8:11
decidePolicyFor not always working for redirects
– canister_exister
Nov 20 at 14:49
add a comment |
You can add observerwebView.addObserver(self, forKeyPath: "URL", options: [.new, .old], context: nil)
and thenoverride func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {print(change?[.newKey],change?[.oldKey])}
– canister_exister
Nov 19 at 14:41
it doesn't get triggered the observer for some reason and I tried different solutions to make it triggered
– P S
Nov 20 at 8:00
@canister_exister I managed to get the url with a similar solution so thanks for the help man. Now I just have to figure out why it is not firing the delegate method.
– P S
Nov 20 at 8:11
decidePolicyFor not always working for redirects
– canister_exister
Nov 20 at 14:49
You can add observer
webView.addObserver(self, forKeyPath: "URL", options: [.new, .old], context: nil)
and then override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {print(change?[.newKey],change?[.oldKey])}
– canister_exister
Nov 19 at 14:41
You can add observer
webView.addObserver(self, forKeyPath: "URL", options: [.new, .old], context: nil)
and then override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {print(change?[.newKey],change?[.oldKey])}
– canister_exister
Nov 19 at 14:41
it doesn't get triggered the observer for some reason and I tried different solutions to make it triggered
– P S
Nov 20 at 8:00
it doesn't get triggered the observer for some reason and I tried different solutions to make it triggered
– P S
Nov 20 at 8:00
@canister_exister I managed to get the url with a similar solution so thanks for the help man. Now I just have to figure out why it is not firing the delegate method.
– P S
Nov 20 at 8:11
@canister_exister I managed to get the url with a similar solution so thanks for the help man. Now I just have to figure out why it is not firing the delegate method.
– P S
Nov 20 at 8:11
decidePolicyFor not always working for redirects
– canister_exister
Nov 20 at 14:49
decidePolicyFor not always working for redirects
– canister_exister
Nov 20 at 14:49
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376588%2fwkwebview-tapping-on-a-ad-doesnt-fire-delegate-method%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You can add observer
webView.addObserver(self, forKeyPath: "URL", options: [.new, .old], context: nil)
and thenoverride func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {print(change?[.newKey],change?[.oldKey])}
– canister_exister
Nov 19 at 14:41
it doesn't get triggered the observer for some reason and I tried different solutions to make it triggered
– P S
Nov 20 at 8:00
@canister_exister I managed to get the url with a similar solution so thanks for the help man. Now I just have to figure out why it is not firing the delegate method.
– P S
Nov 20 at 8:11
decidePolicyFor not always working for redirects
– canister_exister
Nov 20 at 14:49