Start a new topic

UrlListner for iOS

UrlListner for iOS

We have been trying to write the URLlistener but can't find any documentation. Could you please share some sample code with the proper syntax.

Please have a look at the Presenting POI Details example there is a part that displays a native UI Screen based on an event generated in javascript.

Basically you will need to set the document.location to an url starting with "architectsdk://"

var architectSdkUrl = "architectsdk://markerselected?id=" +

encodeURIComponent( +

"&title=" +

encodeURIComponent(currentMarker.poiData.title) +

"&description=" +


document.location = architectSdkUrl;


This will invoke your WTArchitectViewDelegate's "- (void)architectView:(WTArchitectView *)architectView invokedURL:(NSURL *)url" method.


So just set the WTArchitectView's delegate to e.g. your ViewController:


self.architectView.delegate = self;


And implement the above mentioned delegate method.


Hey Wolfgang,

So do we not require to write a URLlistner like we wrote for Android?


Hi, you do have to implement the URLListener it is just called differently to adhere to objective c style.

The WTArchitectViewDelegate is the equivalent of ArchitectUrlListener. It is a protocol that you need to add to your e.g. ViewController's interface:

@interface WTPresentingPoiDetailsARViewController () <WTArchitectViewDelegate>


This is similar to implementing the ArchitectUrlListener on Android.

Now you can implement the method in your ViewControl. Same as overriding/implementing the listeners methods in Java.

- (void)architectView:(WTArchitectView *)architectView invokedURL:(NSURL *)url


To tell the WTArchitectView who should get notified you need to set your ViewController as delegate. E.g. inside your viewWillAppear method.

self.architectView.delegate = self;

This is similar to the registerUrlListener method on Android.

Our HTML code

Wrote the URLListner:



<script src="architect://architect.js"></script>


<body onload = start()>

<script type="text/javascript">

function start(){

    document.location = "architectsdk://showInfo?id=abcd1234";


    alert("Url called..!!");







// In S1ViewController.h confirmed WTArchitectViewDelegate

@interface S1ViewController : UIViewController<WTArchitectViewDelegate>


//In S1ViewController.m 

-set delegate in ViewWillAppear 

-But the following deleagte method does not get call

- (void)architectView:(WTArchitectView *)architectView invokedURL:(NSURL *)url








Hi Mayur,

which iOS SDK version are you using? To make sure that you have implemented the right delegate method, open the WTArchitectView.h file (either by selecing it from the .framework in Xcode or by cmd+click on the header include) and have a look at the WTArchitectViewDelegate protocol definition. Copy and paste the invokedURL method declaration into your project.

If you set the delegate of your WTArchitectView instance in -viewWillAppear:, you could set a breakpoint in e.g. -viewDidAppear: and check if the correct object is set as the delegate.


Best regards


Login or Signup to post a comment