Start a new topic

Communicate between JS & Objective-C

Communicate between JS & Objective-C


Hi Frederik,

 

 

--- JS -> ObjC ---

 

http://www.wikitude.com/external/doc/documentation/latest/ios/browsingpois.html#nativedetailscreen

 

--- ObjC -> JS ---

 

WTArchitectView.h:

 

/**

 * Executes the passed JavaScript string in the context of the currently loaded ARchitect World.

 * This can be used to pass data to the ARchitect World or to notify it of external events.

 *

 * @param javaScript A string, representing the javascript code which should be executed.

 */

- (void)callJavaScript:(NSString*)javaScript;

 

 

Kind regards

 

Daniel

Hi all,

I'm using the Wikitude SDK (iOS Javascript) inside my Objective-C project and I was wondering if there is a way to send data back and forth between Objective-C and JS.

For example, I have a video that gets loaded and shown when an AR marker gets tracked, but when the video is done playing I want to communicate this back to my Objective-C code so I can load a new view controller.
In the opposite direction I want to be able to communicate from Objective-C to the JS file, because I want to be able to set the filename of the video that has to be loaded.

Is this possible? I couldn't really find an answer in the docs.

Cheers,

Frederik
Login or Signup to post a comment