Catch js log in xcode console using web view

can anyone help me catch the JS log message in xcode console, JS should run in web view (UIWebView).

+3
source share
1 answer

to receive a message from one web view, use a custom URL scheme like "log: yourlogmsg"

js code

window.location = "log:yourlogmsg";

using

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType

and return false;

+2
source

All Articles