Home Evaluating javascript function from swift, getting nil in the completion handler
Reply: 0

Evaluating javascript function from swift, getting nil in the completion handler

user611
1#
user611 Published in May 23, 2018, 6:55 pm

In my iOS app, i am loading a url in WKWebView, and on a native iOS button click i am calling a javascript function to execute. I am using the following method to execute the function.

let result = webView.evaluateJavaScript("saveUserTemplate()", completionHandler: {(response, error) in

            print(response as Any) 
            print(error as Any)

        })

Now, the problem is, when the completion handler is fired, i am getting the response and error both as nil.

Please suggest some way to get the response from the java script function.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.318794 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO