Start a new topic

loadARchitectWorld success callback not fired in 1/3 of the cases

Similar to the issue in this topicI 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:

import React, {Component, PropTypes} from 'react';

export default class ARDemoView extends Component {
constructor(props) {
this.wikitudePlugin = cordova.require("com.wikitude.phonegap.WikitudePlugin.WikitudePlugin");

this.sample = {
"path": "",
"requiredFeatures": [
"startupConfiguration": {
"camera_resolution": "auto",
"camera_position": "back"

this.wikitudePlugin.isDeviceSupported(this.onDeviceSupported.bind(this), this.onDeviceNotSupported, this.sample.requiredFeatures);

onDeviceSupported() {
console.log("DEVICE SUPPORTED!");


onDeviceNotSupported(error) {
console.log("DEVICE NOT SUPPORTED", error);

onRequestPermissionSuccessful() {
console.log('loadArchitectWorld', this.wikitudePlugin);
console.log('loadArchitectWorld', this.sample);
this.sample.path, this.sample.requiredFeatures, this.sample.startupConfiguration

onRequestPermissionError(error) {
/* The error object contains two error messages.
* userDescription is a end user formatted message that can be displayed with e.g. a JS alert
* developerDescription is a developer formatted message with more detailed information about the error
/* Here, the userDescription is used to show a confirmation box which, in case of a positive result, shows the applications settings so that user can grant access. */
var openAppSettings = confirm(error.userDescription + '\nOpen App Settings?');
if (openAppSettings == true) {

onARExperienceLoadedSuccessful() {
const array = ["a", "b", "c", 6];

onARExperienceLoadError(error) {
console.log("LOAD ERROR", error);

render() {
return (
<p>AR View</p>

.propTypes = {};

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.

Links to videos mentioned above as embed code doesn't seem to be working and I can't edit post:



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:



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:

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:


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.



The above mentioned change was merged into master of the apache/cordova-plugin-wkwebview-engine plugin.

Login or Signup to post a comment