Start a new topic

InvokedURL is not always invoked


I have a Xamarin forms project and I have implemented wikitude for iOS.

I have a view renderer that show some items with wikitude.

My problem is that when I mark any element, invokeurl is not always called. I don't know why sometimes works but others no.


My iOS code is the following:


public void Start()
CMMotionManager motion = new CMMotionManager();
                motion.DeviceMotionUpdateInterval = 20;

                this.architectView = new WTArchitectView(new CGRect(0, 0, this.Element.WidthRequest, this.Element.HeightRequest), motion);

                ArchitectViewDelegate architectViewDelegate = new ArchitectViewDelegate(this);
                this.architectView.Delegate = architectViewDelegate;

                //Load the AR View
                string absoluteWorldUrl = NSBundle.MainBundle.BundleUrl.AbsoluteString + "ArchitectWorld" + "/index.html";
                NSUrl absoluteNSurl = new NSUrl(absoluteWorldUrl);
                this.architectView.LoadArchitectWorldFromURL(absoluteNSurl, requiredFeatures);

                this.architectView.Start(this.StartArchitechView, this.OnStartedArchitechView);


private void StartArchitechView(WTStartupConfiguration configuration)
            configuration.CaptureDevicePosition = AVCaptureDevicePosition.Back;
            configuration.UseSystemDeviceSensorCalibrationDisplay = false;

        private void OnStartedArchitechView(bool isRunning, NSError error)
            if (isRunning)
                Console.WriteLine("Wikitude SDK version " + WTArchitectView.SDKVersion + " is running.");
                Console.WriteLine("Unable to start Wikitude SDK. Error: " + error.LocalizedDescription);

        private async Task SetupAR()
            var setup = new JsonObject();
            // screen Scale
            var screenScale = new JsonObject();
            screenScale.Add("width", App.ScreenWidth);
            screenScale.Add("height", App.ScreenHeight);
            setup.Add("screenScale", screenScale);

            IEnumerable<Eyetime.Models.Channels.Drop> drops = await ((DropViewModel)this.Element.BindingContext).GetNearbyDrops();
            string dataAsString = JsonConvert.SerializeObject(drops);

            string js = string.Format("World.loadPoisFromJsonData({0},{1})", setup, dataAsString);


And in JS is:


Marker.prototype.getOnClickTrigger = function (marker) 
        The setSelected and setDeselected functions are prototype Marker functions. 
        Both functions perform the same steps but inverted.
    return function () 
        return true;

onMarkerSelected: function onMarkerSelectedFn(marker) {
        World.currentMarker = marker;

        var architectSdkUrl = "architectsdk://markerselected?id=" + encodeURIComponent( + "&type=" + encodeURIComponent(marker.poiData.type);


        document.location = architectSdkUrl;

 The js always display the alert.

Hello Darío,

I have tried to reproduce your issue with the Wikitude Xamarin sample app, but could not.

I simply attached the following function to the onclick event of an HTML button. 


myClickFunction: function() {
    document.location = "architectsdk://mybuttonclicked?action=hellonativefromjs";



<button onclick="World.myClickFunction();" style="position:absolute;top:500px;left:500px;">click me!</button>


All of my clicks generated both the alert dialog as well as a call to the InvokedURL function on the C# side.

Could you try to do the same and report back to me whether it works or not?

Starting from the unaltered Wikitude Xamarin sample app, you would just need to add the two snippets I posted previously in the imageontarget.js file and the index.html file respectively. The unaltered sample app already logs calls to the InvokedURL function by default.

I also attached both these files with the required alterations for your convenience.

Kind regards


(635 Bytes)


I cannot run the iOS sample project.

I create a new solution, download Wikitude component and run. I try changing the default serial to my serial but the project still not working.

I have attached the project.

Thank you!


Good morning,

I ran the code you provided with the latest build of our Xamarin component and found the InvokedURL function to be invoked correctly. I also had no trouble running the code. What issues are you facing? Could you provide the error logs for me to have a look at?

Also, which version of our component are you using?

Kind regards



Sorry, the code crash because missing in info.plist the Camera Usage Description.

I run the project and always invoke url is called.

How can show you what is happening in my project?


you could send your project to me, if you are comfortable with that, so I can have a look and maybe figure out why you are having this issue.

Kind regards


Login or Signup to post a comment