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 Mark ! Thanks a lot for pointing out this relevant update on the wkwebview-engine cordova plugin. I just tried it and unfortunately it did not fix the problem I exposed in this post.


@Andreas / @Wikitude


It is sad to see that Wikitude does not plan to improve its Cordova plugin :-(


Over the years, we were able to develop many great things with this plugin, and doing so we took the time to point out some problems regarding it :

- no support for ionic (even if most of the users on this forum report using this framework...)

impossibility to get the Camera Pos (which is a default fundamental thing in AR, and hinder many scenarios to be explored)

unconvenient architecture with 2 webviews.

- and now the fact that you only plan to support the out-of-date UIWebView on iOS, which is deprecated by Apple btw.

 

We have to say that we are a bit disappointed to see that nothing has been done regarding these limitations, and that nothing is planned about it. It comes to a point were it is now difficult for us to envision new AR projects with Wikitude Cordova.


Also, it is curious to see Wikitude not strengthening its cordova plugin, as it is something that differentiates the company from its competitors.

Might be related to this issue:

https://support.wikitude.com/support/discussions/topics/5000088559


Could you test if this issue is resolved for you using the latest version of the wkwebview-engine plugin?


Best,


Mark

Hi Amaury,

So far I would recommend to still use UIWebView in case you need to have some background JS execution. The link you posted points in the right direction of the problem. We already received similar reports for Cordova a while ago. The best solution would be a much deeper Cordova <> Wikitude SDK integration which is not yet on our roadmap. 


Best regards,
Andreas Schacherbauer

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

Login or Signup to post a comment