Start a new topic

Comunication between JavaScript and iOS

Comunication between JavaScript and iOS


Does anyone know how I can call a iOS method from JavaScript? (Or any tutorial that explains it).

Thank you!

To accomplish this you have to use WTArchitectViewDelegate.


1. implement the protocol WTArchitectViewDelegate in one of your classes

2. set it as delegate of the WTArchitectView


Now in Javascript

3. set the document.location to any url starting with "architectsdk://"

    e.g. document.location = "architectsdk://notifyEventXYZ"


Back in ObjectiveC

4. the delegate's urlWasInvoked method is called with the above url as parameter.

5. parse the url and react accordingly


Top tip:

you can use parameters in the url. e.g. "architectsdk://notifyEventXYZ?poiid=123"

Thank you very much! I am not an expert in iOS but I will try and I'll tell you then.


Hello again!

What class should implement the WTArchitectViewDelegate methods? 

that is up to you. Depending on your app design it probably makes sens to have the ViewController respond to the WTArchitectViewDelegate protocol.

e.g XYZViewController.m

@interface XYZViewController () <WTArchitectViewDelegate>


// ...
- (void)urlWasInvoked:(NSString *)url
NSLog(@"url was invoked: %@", url);


OK. But in Android you have to call arhitectView.registerUrlListener('ActivityThatImplements_ArchitectUrlListener'). Don't you have to do something similar in iOS? I can't find that method for registering in architectView in iOS.

Another issue: How can I set my class as delegate of the WTArchitectView?? (I am an iOS beginner).


Here is a good explanation from the apple documentation on delegates:

For our SDK this means setting the delegate property of WTArchitectView to your object that response to the protocol.

Done!! Thank you very much Wolfgang!!

I didn't know how to make my class the delegate of architectView. I solved it with this line: self.architectView.delegate = self;

Login or Signup to post a comment