UIWebView - significant and long lasting CPU usage after executing any JS code

I have quite large HTML that I need to render using a UIWebView. Everything is good. The problem is after calling ANY JS code (via stringByEvaluatingJavaScriptFromString :) WebThread is using 100% CPU for a few seconds, freezing my application. Freezing occurs one second after the JS is executed.

NSString *jsres = [webView stringByEvaluatingJavaScriptFromString:@"0"];

      

See image below. Green is initial CPU usage (let's say OK), red is after calls to JS. enter image description here

Why is this happening and how to avoid it?

+3
javascript ios objective-c cocoa-touch uiwebview


source to share


No one has answered this question yet

Check out similar questions:

651
Why doesn't my variable change after I change it inside the function? - Asynchronous code
651
How do I get JavaScript to work after the page has loaded?
354
Fast and Fast PDF Viewer for iPhone / iPad / iOs - Tips and Tricks?
18
Can't change UserAgent in UIWebview after page load
2
IE renders before requestAnimationFrame
1
UIWebView stuck a second time
0
Loading UIWebViewHTMLString: Sometimes it takes 10+ seconds to load
0
UIWebView content is sometimes not displayed
0
high CPU usage after setting JavaScriptInterval
0
iOS Javascript Workers High CPU after completion ()



All Articles
Loading...
X
Show
Funny
Dev
Pics