Community
Topic: Xamarin component
pikkart for Xamarin Forms / iOS native run issues (SOLVED)
Hi all,
I am trying to convert the iOS sample to Xamarin Forms. I have created a PageRenderer that can be called from forms app.
Full sample code is available here https://gitlab.com/dn-misc/pikkartXamarinFormsDemo
During the execution in the PageRenderer I am encountering the error when
This is OnElementChanged rom PageRenderer where error is encountered, it is happening when geoMain PKViewController is added to the root ViewController.
What am I doing wrong compared to the standard iOS sample.
protected override void OnElementChanged(VisualElementChangedEventArgs e)
{
base.OnElementChanged(e);
if (e.OldElement != null || Element == null)
{
return;
}
try
{
var page = e.NewElement as PKPage;
var view = NativeView;
var hostViewController = ViewController;
string kGMapManagerGoogleMapsAPIKey = "AIzaSyA7uiTxeRFbbYaK-Y1j6xmXZtcI8ayOb6Y";
PKTGeoMainController.SetGoogleMapsKey(kGMapManagerGoogleMapsAPIKey);
PKViewController geoMain = new PKViewController(new GeoViewMarkerAdapter(new CGSize(30, 45)),
new MapViewMarkerAdapter(new CGSize(40, 40)));
geoMain.View.Frame = UIScreen.MainScreen.Bounds;
hostViewController.AddChildViewController(geoMain);
hostViewController.View.Add(geoMain.View);
geoMain.DidMoveToParentViewController(hostViewController);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"\t\t\tERROR: {ex.Message}");
}
}
Hi,
please note that augmented video tutorial is not intended for commercial use, it is only an example of an application of our recognition SDK functionalities.
Anyway, could you please some further details about your scenario?
Did you use the original GitHub tutorial (native or Xamarin) or a modified project (for example, did you use the original video, another one or a remote url link)?
On which Apple smarphone/tablet do you deploy the tutorial?
Thanks
Kind Regards
HI,
this project is based on the original github augmented marker iOS project.
In fact in pikkartXamarinFormsDemo/iOS/AppDelegate.cs
there is full code from your github sample, if xamarin.forms initiation section is commented out, IOS section of the app runs exactly as your sample.
What I am trying to do now, to add PKViewController in the view for for the xamarin.forms
I have created a separate viewcontroller pikkartXamarinFormsDemo/iOS/PKViewController.cs
that I am trying to add to view from forms app in the pikkartXamarinFormsDemo/iOS/PikkartPageRenderer.cs (this is what forms.app is calling)
I can see no errors but view appears black, this is where view gets added - hostViewController.View.AddSubview(geoMain.View);
View looks like added but it is black - and I can remember that I read somewhere that these are symptoms when license is not ok or geopoints are not added ok
Thanx,
DiNo
Hi,
please check this post where you should find the step to resolve the issues.
Kind Regards