I am developing using the native sdk and creating the augmented reality scenarios using the Wikitude Studio.
I added buttons (using Studio) that lead to different URLs. How can I prevent the sdk to open the url in its own webview, but receive the link and manually pass over to my custom ViewController so I display it on a custom UIWebView?
A
Andreas Schacherbauer
said
about 7 years ago
Hi Shen, Just to avoid any communication erros. You are using the Wikitude SDK with the JS API right? Because we also have a SDK with pure ObjC/Java APIs but this SDK is unable to load Architect Worlds (That's what Studio exports).
When using Studio, you can't redirect button clicks to ObjC. You would need to wirte your Architect World in JS. When doing so, you could define the button click to "document.location = 'architectsdk://my_custom_string_that_is_available_in_objc'" and implement the WTArchitectViewDelegate to receive the custom URL. Once you have the URL in ObjC, you can present any view controller you want.
Best regards
Andreas
F
Frontdesk
said
about 7 years ago
Hi Andreas,
I am exporting from Studio, <Download for Self Hosting> option and getting a zip with index.html, js files and the images that are augmented. I load this content into our native ios app by using this below. I tried manually editing the links in the content_mini.js file (generated by Studio), but I cannot get the ios app to trigger a delegate call when the button is tapped.
;
self.architectView.delegate=self;
;
This is the delegate function that I used, but it does not get called:
Is there any example where the architectsdk:// scheme triggers the delegate that I can use?
Is what I am trying to achieve possible?
Thanks.
A
Andreas Schacherbauer
said
about 7 years ago
Your code looks fine. Studio project exports are not meant to be editable afterwards. Our next version of Studio will export them in a more readable way. With Studio I guess it's not that easy to do what you want. I tried it quickly and wasn't able to get the -architectView:invokedURL method called. I recommend to write the Architect World yourself. Everything that Studio does can be easily written with a few lines of JS code. You can have a look at the example application which ships with the SDK package. It contains a lot of JS examples that might answer a lot of your questions.
Best regards
Andreas
F
Frontdesk
said
about 7 years ago
The whole point of using the Studio is to easily edit the AR experience. Using Studio, I can place the images visually, to the exact position.
Doing that in code is not easy at all..
I managed to edit the Studio export converter.js a little bit to trigger architectsdk:// urls.
I still need a way to load an url once the marker is detected. I see this is not possible either with Studio..
A
Andreas Schacherbauer
said
about 7 years ago
You need to find a way to add the onEnterFieldOfVision/onExitFieldOfVision trigger to the Trackable2DObject that is defined in the Studio export. These callbacks are called if a target image was found/lost in the camera stream.
Frontdesk