Start a new topic

InjectLocation in Xamarin Component 5.3.0 for iOS is not working.

InjectLocation in Xamarin Component 5.3.0 for iOS is not working.


I am trying to create a simple AR Xamarin application with POI functionality. I am using Wikitude component 5.3.0 with iOS 10.2 on iPhone 5S, wtih Xamarin Studio 6.1.1 and Xamarin iOS I am using MvvmCross to create the PCL library with shared code and trying to create my UIViewController with WTArchitectView. I've created a custom binding for getting location update from myviewmodel. The code for the project is accessible here The problem is that the I couldn't get location update and onLocationChanged JS function don't get called.  I've setup LocationAlwaysUsageDescription settings and I enable using location informaton in the app when prompted. I even get location information (latitude longitude) when debugging. However, when I tried to used  InjectLocation ( method with specific coordinate info the onLocationChanged handler in JS doesn't get called ( Moreover, the IsUsingInjectedLocation on WTArchitectView instance always set to false and doesn't changed to true even when I specify UseInjectedLocation = true;

The similiar setup for the Android project works fine, I've attached it as well. 

I tried to used your official Xamarin example but they are outdated. After I upgrade to te latest version and fix some compilcation bugs (there is some change in API compare with latest version) it still produce the same results (e.g. onLocationChanged  event don't get called and InjectLocation  method do nothing.

Please advise on what may be the cause of the problem. Did I miss something I need to setup in iOS applcaition for recieving update location update? Why is IsUsingInjectedLocation property always set to false and how can I set it to enabled?

Also, if you can please provide a working sample of POI at location example for latest Xamain component version (5.3.0) for IOS this will be very helpful

Hi Dmitry,

my apologies for having you wait this long for an answer. I believe, however, that I found the issue in your code that's preventing the onLocationChanged callback to be invoked. In your AugmentedRealityControl/Utils/Constants.cs file you define the attribute

public const int WikitudeRequiredFeatures = 3;

which you cast to the Wikitude.Architect.WTFeatures type and pass to the LoadArchitectWorldFromURL function in the AugmentedRealityControl.iOS/ArchitectViewController.cs file. I believe you intended this to enable the 2DTracking feature and the Geo feature as 
Wikitude.Architect.WTFeatures.WTFeature_2DTracking | Wikitude.Architect.WTFeatures.Geo

  would do. This bit-wise disjunction, however, yields the value 5 in base 10, not 3.

Wikitude.Architect.WTFeatures.WTFeature_2DTracking is defined as 1 << 0 which is 1 in base 2
Wikitude.Architect.WTFeatures.Geo is defined as 1 << 2 which is 100 in base 2
001 ? 100 = 101 which is 5 in base 10.

You can confirm this with the Assembly browser, which will tell you that WTFeatures is defined as follows:


public enum WTFeatures : ulong
WTFeature_2DTracking = 1uL,
Geo = 4uL


There actually is another WTFeatures constant for 3DTracking which is not exposed to the Xamarin API. It is defined as 1 << 1 which explains the gap in-between the other two flags. I recommend using our flags as we don't make any guarantees regarding the underlying values.

I am confident this will resolve your issue since I was able to run a trivial sample using AR.context.onLocationChanged and InjectLocation on an iPhone5S with iOS 10.

Kind regards

Thank you so much, I've tested and this resolves the error! This ticket can be closed now.
Login or Signup to post a comment