Start a new topic

[iOS] Weird behavior of the main webview on WKWebView

Hi Wikitude,


On iOS, we have some trouble in using WKWebView with Wikitude.


It seems that the main webview (the one that is used to launch the AR World) is put to pause when the AR view is alive. 


For instance, before launching the AR world, if I set up an interval like this :

setInterval(function(){
    console.log("sending stuff to AR view");
    var now = Date.now();
    var command = 'fromCordova('+now+','+app.countARCalls+')';
    app.wikitudePlugin.callJavaScript(command);
    app.countARCalls++;
},100);

And on the AR view, if I have a function that log that we have received a call from the main webview : 

fromCordova = function(date, counter){
	var now = Date.now();
	var diff = now - date;
	console.log("from Cordova called "+counter+' - '+diff);
}

 

Then it works perfectly when using UIWebView with my Cordova project. With the WKWebView, it does not. The interval function in the main webview is never called, and the fromCordova function in the AR webview neither.


If I "wake up" the main web view with some sendJsonObject, then the interval function is called, but with a maximum frequency of 1000ms (even if I have specifed a 100ms interval ??).


So I think that there are some settings to configure on your side so that the main web view behave normally with WKWebView.


BTW, I used this cordova plugin to set up the WKWebView on my project :

https://github.com/apache/cordova-plugin-wkwebview-engine

And I did my tests from you plugin-sample app with the SDK v7 and v8.


This is a big problem for us as we rely on cordova plugins (that can only communicate with the main web view) to get beacons signals for instance, and with WKWebView we get the signals far less often than with the UIWebView.


Moreover, as hybrid app developers, using the WKWebView on iOS is very important as it better embraces the last web standards and it is way more performant. Also the UIWebView has been deprecated on iOS 12.


Hope you can have a look soon. Don't hesitate to ask if you need more details on how to reproduce the problem.


Hi @Wikitude. Did you manage to reproduce the problem ? Thanks :-)

Login or Signup to post a comment