Hi Jacob,
We recently replaced `setOnUrlInvokeCallback` & `document.location = architectsdk://` approach with a new one. The new JS API is called `AR.platform.sendJSONObject`. There is a function in our Cordova plugin that behaves similar to the already known `setOnUrlInvokeCallback` named `setJSONObjectReceivedCallback`.
Having sad that we know that there are some issues with Ionic based applications (Please note that we don't officially support Ionic at the moment) which are originating from WKWebView. If you can switch to UIWebView, you shouldn't experience those though.
Best regards,
Andreas
Hi Andreas! Thanks for the info. The new JS API that you noted is working great!
Jacob Jordan
I am seeing very strange behavior in iOS when using the setOnUrlInvokeCallback function in my Ionic based app. In the AR scene when invoking the callback via:
The callback will to do one of three things:
- Receive the correct string and behave as expected
- Receive the string that was last set to document.location.href
- The callback is never called
For example, using this code (Typescript - Ionic):
and (Typescript - AR Scene)
I will see behavior similar to this:
- call action1();
- Wikitude console:
Action 1 called
- Ionic console:
// Nothing happens
- call action2();
- Wikitude console:
Action 2 called
- Ionic console:
url is architectsdk://button?action=action1
- call action3();
- Wikitude console:
Action 3 called
- Ionic console:
url is acrchitectsdk://button?action=action2
- call action1();
- Wikitude console:
Action 1 called
- Ionic console:
url is acrchitectsdk://button?action=action3
Sometimes it appears that it will 'catch up' and do the correct action until an action happens and the urlCallback is not called. At which point, this behavior seems to start again.
Any help would be appreciated, I am using SDK7.
This behavior does not seem to happen on Android.