Javascript performance in UIWebView not in current ViewController with iOS 8

I am currently developing a hybrid HTML / Native application with Apache Cordova for iOS and Android. For this application, I use the UINavigationController, because I wanted to use swipe to return the function available in iOS 7. In my original ViewController, I create some other native controls and therefore some of the JS code interacting with these controls work in this the controller.

One such control is the UITableView in its own ViewController. I immediately click ViewController on my UINavigationController while I wait for my data to be downloaded from a remote server or from my local database.

When loading from my local database, I noticed that it took almost 2 seconds to load the results into a UITableView on my device running iOS 8 (iPhone 6). Then I tested the exact same thing in a simulator running on iOS 8, and the same delay appeared. Testing with iOS 7 in the simulator did not give any delay.

This morning I decided to find out why the code is much slower in iOS 8 than in iOS 7. Checking that it was not only my code, the problem is that I was running a sample code from this plugin: https://github.com / brodysoft / Cordova-SQLitePlugin and got the same result.

Assuming that there was something else in my code that was causing slowness, I decided to create a new project on which only sample code was running, and it quickly ran in both iOS 7 and 8, so the problem should have been somewhere- then in my code. I gradually began to add bits and pieces of my original project to a new one until the code slowed down.

Only when I restored all the code, which noticed that the code is slow in some parts of the application. If Javascript was used up in the current view controller, it worked fine, but once it worked in the background controller, it became slow.

Knowing why the code was slow, he pretty easily fixed it. All I had to do was stick to the Cordoba UIWebView in the same view controller as my UITableView, and get it to run Javascript after loading.

- , Javascript , iOS 8? , Apple UIWebView iOS 8 WKWebView, , , .

+4

All Articles