Start a new topic
Solved

IOS - loadARchitectWorld success callback with WKWebViewEngine

Hi.

I have a similiar problem as described here:

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


The success callback on IOS (android is ok) does not work when using WKWebView instead of UIWebView in my cordova (ionic2 to be specific) application. It gets called when I hide the app or go back to the main app. Tried your samples and my own ar experience.


WKWebView is pretty much needed for my app, so I can't go back to UIWebView. Some assistance in this matter would be greatly appreciated.


Plugins used:

https://github.com/driftyco/cordova-plugin-wkwebview-engine

https://github.com/apache/cordova-plugin-wkwebview-engine


Cordova CLI: 6.3.1

WikitudePlugin: 3.3.1

WKWebView configuration (in config.xml)

 

<feature name="CDVWKWebViewEngine">
    <param name="ios-package" value="CDVWKWebViewEngine" />
</feature>
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />


Kind regards,

Michal


Hi Michal,

The Wikitude iOS SDK uses a UIWebView internally and we can not change this at the moment. 

What confuses me is that the load callback is not called if you switch the Cordova web view. Cordova's web view is a different one from the Wikitude iOS SDK.


Can you start your application in debug mode and set a breakpoint in WTWikitudePlugin.m, line 676?


Best regards,

Andreas

 Hi, sorry for late response.


I did what you asked for, but I think you gave me wrong line number. I assume, that you meant line 626 of didReceivedWorldDidLoadNotification function. Well, it is called.


image

Do you need a specific object info?


Best regards,

Michal

Hi, I have some updates.

I have created a minimal app on github showcasing this problem. It's ionic2 app (cordova) with one of your sdk examples (multiplepois)
https://github.com/qbix0r/wikitude-test

 

How to install:

npm install -g ionic (it uses newest rc5 version)

npm install -g cordova


npm install

Put your SDK licence key to /src/pages/home/home.ts, line 21


Running on ios:

ionic platform add ios

ionic build ios --device (It will probably fail on signing product, but it's fine)

open generated cordova project in xcode, set the signing profile and you are ready to go


Running on android:

ionic platform add android

ionic run android (it will deploy to first device shown in adb devices)

So - where is the problem? There is some strange behavior on AR start on. When using WKWebView it shows the location access prompt, then after 0.5s the screen blinks and it reloads(?) the ar. Debugger shows that you need a NSLocationWhenInUseDescription or to accept the location request. Meanwhile it shows the camera permission request, I hit accept. Then again(!) the location request. Again, at this point in the debugger there was allready info that i had to accept it or use NSLocationWhenInUseDescription in plist (which by the way is present).


When you remove the WKWebView plugin and use standard UIWebView everything works fine.

Android also works fine.


I would greatly appreciate some help here.


Kind regards,

Michal

https://youtu.be/XpFKWQuMrd4

After 1st location prompt:
----------------- Wikitude SDK REQUIREMENT NOT FULFILLED -----------------
2017-01-18 16:26:23.991353 wikitudetest[295:12594] CoreLocation Authorization Status is not determined - All ARchitect World load requests are on hold!
2017-01-18 16:26:23.991486 wikitudetest[295:12594] This problem occurs because you've called the method 'loadArchitecteWorldFromURL:withRequiredFeatures:' with a feature that contains Geo Requirements.
2017-01-18 16:26:23.991612 wikitudetest[295:12594] To resolve this problem, either accept the iOS location access prompt or make sure that the 'NSLocationWhenInUseUsageDescription' key is defined in your applications Info.plist.
2017-01-18 16:26:23.991740 wikitudetest[295:12594] Set the key's value to e.g. 'Access to GPS information is needed to display POIs around your current location'.
2017-01-18 16:26:23.991817 wikitudetest[295:12594] Affected URL's: 
2017-01-18 16:26:23.993052 wikitudetest[295:12594] 	URL: file:///var/containers/Bundle/Application/3A53AF54-5F80-4273-881B-95B21E767BC0/wikitudetest.app/www/assets/ar/index.html

 

 

Hi Michal,

This log output is expected with the Wikitude SDK 5.x. It's ok to appear and should not indicate to any particular issue. Our new SDK 6 offers a new authorisation process shown in our Cordova example application. 

Since your screenshot shows that you hit the breakpoint, it's maybe lost in the Cordova/Ionic bridge. You could check the content of the `self.loadArchitectWorldCallbackId` property. As long as this is not nil or empty, a JS callback should be fired (if there are no JS syntax issues). Did you tried to debug it with Safari Web Inspector?


Best regards,

Andreas

Hi everyone !


Any news on this topic ? Is it possible to make Wikitude work with WKWebview ?


Thanks,


Amaury.

Hi Amaury,

We haven't had a look into it for now. I put it again in our todo list, but don't expect any changes soon as we're currently working on the next minor update.


Best regards,

Andreas

Hi, I was able to get WKWebView to work with Wikitude, but sadly i can't point exactly where was the problem. I did some code cleanup and refactoring and what I believe did the trick - setting the keys like NSLocationWhenInUseUsageDescription for location and camera in Info.plist

 Hope it will help.

Hi @all,

We tested the official WKWebView plugin in combination with the Wikitude Cordova Plugin and couldn't identify any issues. If you do, please create a new thread and let us know, thx.


Best regards,

Andreas

Login or Signup to post a comment