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


source to share





All Articles