Hi,
I just tried what you wanted to accomplish from scratch and found it to be working. I started with the Xamarin sample and also used the 07_ObtainPoiData_1_FromApplicationModel Javascript world.
Here's what I changed:
if (null == loadingArchitectWorldNavigation) { var path = NSBundle.MainBundle.BundleUrl.AbsoluteString + "07_ObtainPoiData_1_FromApplicationModel/index.html"; loadingArchitectWorldNavigation = architectView.LoadArchitectWorldFromURL(NSUrl.FromString(path), Wikitude.Architect.WTFeatures.Geo); string json = "[{\"id\":\"1\",\"latitude\":\"47.805645\",\"longitude\":\"13.041769\",\"altitude\":\"424.0\",\"name\":\"Mirabell garden\",\"description\":\"A fancy description of the POI in lovely Mirabell garden.\"}]"; string concatenated = "World.loadPoisFromJsonData(" + json + ");"; this.architectView.CallJavaScript(concatenated); }
NSOrderedSet<NSNumber> restrictedAppleiOSSKDAPIs = WTAuthorizationRequestManager.RestrictedAppleiOSSDKAPIAuthorizationsForRequiredFeatures(WTFeatures.Geo);
Comparing with the code you provided reveals that you had WTFeatures.WTFeature_ImageTracking set instead of WTFeatures.Geo in both instances. On any other things that might be wrong with you code I cannot comment, as I didn't look at it that deeply. I trust, however, that you can build your sample based on what I just sent you.
- Daniel
Thank you Eva,
I upload my files to Github:
https://github.com/binrucao/wikitude-with-xamarin-IOS
Thank you again for helping!!
Hi,
Thank you Eva.
After i correct the callJavaScript line, this still not work. I don't know if i need do some change in the html file? (Just guess). Or what could i do to check where is going wrong?
//you are using this.architectView.CallJavaScript("World.loadPoisFromJsonData(\" +json + \")"); //but instead it should be this.architectView.CallJavaScript("World.loadPoisFromJsonData(" + json + ");");
You can also check it here.
Thanks
Eva
BINRU CAO
Hello, currently i am working on a Xamarin iOS app project. In my project, i used the wikitude SDK for my AR function. i am really new about the javascript so if my question is stupid please forgive me...
Here is the problem that stuck me for weeks:
I use the example "07_ObtainPoiData_1_FromApplicationModel". What i want is sending some objects in a JSON string format to javascript file dynamically. The instruction said: "Use the platform common way to create JSON Objects of your data and use native 'architectView.callJavaScript()' to pass them to the ARchitect World's JavaScript.
'World.loadPoisFromJsonData' is called directly in native code to pass over the poiData JSON, which then creates the AR experience." So i create JSON objects in my viewcontroller(c# part), then use the callJavaScript() function to parse the JSON, but it failed and say "try to find out where you are".
My c# code:
The javascript code:
The function "loadPoisFromJson()" is inside of object "World". When i write an other function out of "World", and call this function in c#, the JSON object can be send successfully.
I really don't know what happened here, could some one help me?
Thank you very much