Ionic + Wikitude (app and AR view interactions)


Initial situation:
We’ve originally created an app with only cordova and wikitude, which functioned perfectly. We then decided make the app using Ionic and adding a few features.

The Wikitude (cordova) Plugin has 2 functions to help it interact with the app from the AR view (sendJSONObject() + onJSONObjectReceived() and document.location = ‘architectsdk://…’ + onURLInvoked()). The problem arises when trying to send data (sendJSONObject() / document.location = ‘architectsdk://…’) from the Ar view to the app (onJSONObjectReceived() / onURLInvoked()). The data isn’t always received by the app.

We have a button in the AR view which when clicked sends the data to the app telling it to close the view. When we press the button the first time, nothing happens. When we press the button a second time, the event is sent (received) twice -> the event from the first and second clicks are sent together on the second click.

With much testing and the help of Wikitude we have come to the conclusion that the problem only persists on the ios platform with the ionic framework, and the event is sent correctly to the native part of the plugin. The event is then lost on the way between objC (Native) and JS/TS (Ionic).

Wikitude told us that they cannot help us in this case and that we should try turning to the Ionic forum… so here we are.

There is a wikitude ionic starter app which has the same problem, and can be used for testing:

node version: v8.9.4
npm version: 5.6.0
ionic version: 3.19.0
cordova version: 8.0.0 (or 7.1.0)
app-scripts version: 3.1.5
cordova ios platform version: 4.5.4
Wikitude plugin version: 7.1.0 (or 7.0.0)
OS: macOS Sierra
Xcode: Xcode 9.2

Any help would be appreciated.



you should use UiwebView
WkWebView is the problem