Start a new topic

AR.context.openInBrowser crashes iOS App

AR.context.openInBrowser crashes iOS App


Currently I am facing this issue. 

Found any solution?

Hello!  

 

I am working with AR.HtmlDrawable and I have noticed it crashes iOS App when AR.context.openInBrowser is called inside of onDocumentLocationChanged. I have tested the AR.context.openInBrowser called with other Drawables and it works well. It opens native browser and loads supplied URL. However when used inside the onDocumentLocationChanged is crashes the app.... 

 

When target image is recognized HTML drawable is loaded on the screen. Inside of that HTML drawable there is alink "a href" which simply points to another HTTP address. When link is tapped and onDocumentLocationChanged is called alert(theuri)  will display correct web address - http://www.mywebpage.com... everything is ok. However if I AR.context.openInBrowser it opens the browser and immideately crashes both the browser and the app. I tried loading many different URLs and the result is the same... I am out of ideas on what could be wrong. Have you experienced this before? Do you know why could the AR.context.openInBrowser crash my app? I tried using the example of HTML Drawable from Wikitude web site and it still crashes my iOS app as soon as AR.context.openInBrowser is called from onDocumentLocationChanged..... 

 

 

var weatherWidget = new AR.HtmlDrawable({

    uri: "<webpageUrl>"

    }, 1, {

    viewportWidth: 320,

    viewportHeight: 320,

    offsetX: 0,

    offsetY: 0,

    clickThroughEnabled: true,

    allowDocumentLocationChanges: false,

 

   onDocumentLocationChanged: function onDocumentLocationChangedFn(theuri) {

        AR.context.openInBrowser(theuri);

   }

});

 

  var pageOne = new AR.Trackable2DObject(tracker, "target_image_name", {

    drawables: {

        cam:

    }

 });

 

It got it working by forcing a native browser to open: 

AR.context.openInBrowser(theuri,true);

Other wise iOS app will crash:

AR.context.openInBrowser(theuri)

Android App worked stable though. 

 

 

 

What I have noticed now is that with 

AR.context.openInBrowser(theuri,true) called inside of the onDocumentLocationChanged function, a new browser window will open and load url on ios device well but will not work on Android at all. On Android device it will not even trigger the onDocumentLocationChanged even though the clickThroughEnabled is set to true:

clickThroughEnabled: true

and the allowDocumentLocationChanges is set to false or true: 

allowDocumentLocationChanges: false or true 

I have tried setting allowDocumentLocationChanges to true as well but on Android for some reason it does not have any effect while on iOS works well. As soon as I tap a very large button inside the AR.HtmlDrawable the onDocumentLocationChanged is called immediately while on Android devices on tap does not produce any result. 

Does it mean that on Android I should do it differently? 

 

Hi Sergey,
I did some tests with iOS today to verify the crash you mentioned. So far I was unable to produce a crash on iOS when using HTMLDrawables & openInBrowser. 

Can you again send us a demo project to ios-sdk@wikitude.com which demonstrates the problem? That would be very helpful!

In general iOS & Android should behave the same when it comes to HTMLDrawable & openInBrowser.

Best regards

Andreas
Login or Signup to post a comment