Start a new topic

Xamarin IOS url listener

Xamarin IOS url listener


Hello,

I'm using wikitude xamarin component to build an AR app for ios.

How can i implement the interface to listen url invoked by the AR like i do in Android?

I didn't find documentation about that.

Thank you!

Hi Luca,
You need to create a new class which derives from WTArchitectViewDelegate. In this subclass you can override all the WTArchitectViewDelegate methods you like, e.g. the InvokedURL method. After this is done, create a new member of that custom type in the class where you instantiated the WTArchitectView class already. Then, assign the WTArchitectViewDelegate subclass member to your WTArchitectViews object property `delegate`.

Our interface follows the typical iOS SDK delegate pattern, so any example/tutorial about delegates on iOS should also apply for our SDK.

Here are some snippets you might find interesting:

 

Custom WTArchitectViewDelegate subclass

public partial class ArchitectViewDelegate : WTArchitectViewDelegate 
    {
        public override void InvokedURL(WTArchitectView architectView, NSUrl url)
        {
            Console.WriteLine("architect view invoked url: " + url);
        }
    }


New member of that WTArchitecdtView subclass

private WTArchitectView architectView;
private WTNavigation navigation;
private ArchitectViewDelegate architectViewDelegate = new ArchitectViewDelegate ();

 

Assignment of the delegate right after WTArchitectView instantiation

this.architectView = new Wikitude.Architect.WTArchitectView ();
this.architectView.Delegate = architectViewDelegate;

 

Best regards,

Andreas
Login or Signup to post a comment