Links to videos mentioned above as embed code doesn't seem to be working and I can't edit post:
Broken: https://youtu.be/ViG53GzV4fI
Working: https://youtu.be/UqYHbk0NZiU
Hi Mark,
I just tried to reproduce this on an iPhone 8 running iOS 11.4, but could not. For me, the success callback in invoked consistently. Is this happening on a specific device only?
Have you tried reproducing this behaviour in the Cordova sample app we provide? I'd be interested to know whether it happens in the sample app as well for you.
- Daniel
Hi Daniel,
I tested the Sample app and indeed there the callbacks are called all the time.
Could it be related to the fact that my Cordova app uses WKWebview?
In fact it is a Meteor app using cordova-plugin-meteor-webapp:
https://github.com/meteor/cordova-plugin-meteor-webapp
Best,
Mark
Good morning Mark,
hard to say what the underlying issue could be, but I can certainly imagine your app using WebKit to cause some sort of issue. In any case, I'm afraid I can't provide support regarding interoperability with the Meteor plugin. We only provide support for plain Cordova apps and you would need to demonstrate an issue in such an environment for me to be able to address it. We simply lack the resources to consider the entire Cordova ecosystem.
- Daniel
Hi Daniel,
Thanks for getting back to me - after some thorough investigation from our side the problem seems to be indeed related to the fact that we are using a Cordova with WKWebView plugin (cordova-plugin-wkwebview-engine).
There is some power consumption optimization built into iOS10+ when the webview disappears to the background (which it does when the ARWebView is loaded). Therefore the nativeCallback implementation is not executed properly since it is wrapped in a setTimeout function. Replacing it with a Promise has resolved the issue for us.
Related issue:
https://issues.apache.org/jira/browse/CB-10657
Should anyone run into this problem as well, replace the timeout with a Promise as described below:
In the cordova-plugin-wkwebview-engine make the following change:
/src/www/ios/ios-wkwebview-exec.js
Line 127:
//setTimeout(function () { //cordova.callbackFromNative(callbackId, success, status, args, keepCallback); // eslint-disable-line //}, 0); Promise.resolve(cordova.callbackFromNative(callbackId, success, status, args, keepCallback)); // eslint-disable-line
Hope this helps anyone running into the same type of issues.
Best,
Mark
The above mentioned change was merged into master of the apache/cordova-plugin-wkwebview-engine plugin.
Mark Naus
Similar to the issue in this topic, I run into the situation where the "success" callback of the loadARchitectWorld function does not get called sometimes on iOS. In about 2/3 of the cases the callback gets successfully called - however in 1/3 of the cases it requires some behavior to get the AR view to 'wake up' as it seems. E.g. by pressing the home button to minimize/maximize the app. Upon minimization the callback gets executed.
I've made videos of the behaviour both the working as well as the broken case:
Code snippet - corresponding to the video and the shown "console.log" in the Safari debug view:
iOS version: 11.4.0 & iOS developer beta 8
Wikitude SDK: 8.0.0
This is preventing me from (reliably) passing information to the AR World using the callJavaScript function in the success callback.
Any help/suggestions would be greatly appreciated.