Start a new topic

setUseInjectedLocation() not working in iOS JS API

Hi,

I am using Wikitude SDK iOS JavaScript API  (version: 7.2.1 ) with Swift 3 and wanted to provide fixed location but this setUseInjectedLocation() method doesnt seem to work!

I am trying to set it to true in startWikitudeSDKRendering() as well as inside didFinishLoadArchitectWorldNavigation. 

Code snippet:


self.architectView?.setUseInjectedLocation(true);

 let location:CLLocationCoordinate2D = CLLocationCoordinate2D(latitude: Double(("12" as NSString).doubleValue), longitude: Double(("77" as NSString).doubleValue));

 if (self.architectView?.isUsingInjectedLocation())! 

{

 

 self.architectView?.injectLocation(withLatitude: location.latitude, longitude: location.longitude, altitude: 900, accuracy: 1);

 }


It never goes inside the if block!



I saw a similar post at - https://support.wikitude.com/support/discussions/topics/5000075538 but that also is not helpful.



1 person has this problem

Any help on this please, is there a bug in the SDK or need to implement it in a different way ?


Also, I tried a workaround to pass the coordinate directly in a custom JavaScript function using architectView?.callJavaScript( "xyz" ) to set the user location but that also doesn't work and the user location in AR view doesnt change to given location. Its still showing the POIs as per the location from GPS ( have disabled the user location updates inside locationChanged: function locationChangedFn(lat, lon, alt, acc) { } in the nativedetailscreen.js )  .


I am using Swift 3 and testing on iOS 9.


Thanks 



Hi,

Can you please try to first inject a location and then call `setUseInjectedLocation` to true?


You can only inject custom locations in the ObjC or Java layer of our SDK, not in the JS API.


Best regards,
Andreas Schacherbauer

Hi Andreas,


Thanks for getting back to me. Actually , I have tried it already and this also doesn't work.

I am using Swift 3 and testing on an iOS 9  device. I hope below is the sequence you are referring to -



 let location:CLLocationCoordinate2D = CLLocationCoordinate2D(latitude: Double(("12" as NSString).doubleValue), longitude: Double(("77" as NSString).doubleValue));
self.architectView?.injectLocation(withLatitude: location.latitude, longitude: location.longitude, altitude: 900, accuracy: 1);
self.architectView?.setUseInjectedLocation(true);

I have tried it in both  startWikitudeSDKRendering() as well as inside didFinishLoadArchitectWorldNavigation() methods but unfortunately cant get it to work. 


 Thanks

Sandeep


Login or Signup to post a comment