Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

MapView does not show

$
0
0

I'm building a xamarin forms using PCL. One of my button should redirect to a map.

To do that, in the ios project, I have the following code

var map = new MKMapView(UIScreen.MainScreen.Bounds)
            {
                //ShowsUserLocation = true
            };
            var mkPointAnnotation = new MKPointAnnotation
            {
                Title = title,
            };
            mkPointAnnotation.SetCoordinate(new CLLocationCoordinate2D(42.364260, -71.120824));
            map.AddAnnotation(mkPointAnnotation);
            var contentPage = new ContentPage();
            contentPage.Title = title;
            var uiViewController = contentPage.CreateViewController();
            uiViewController.View.Frame = UIScreen.MainScreen.Bounds;
            uiViewController.View = map;
            UIApplication.SharedApplication.KeyWindow.RootViewController.PresentViewController(uiViewController, true, null);

However, when I execute this code, I have a blank page.

I found on the forum (http://forums.xamarin.com/discussion/8418/mkmapview-not-showing-ios-7) that I can add some compilation arguments "-gcc_flags="-framework CoreGraphics"".
However, my application does not launch as I suspect a problem with System.Net.Http. I have the following warning :
The existing binding redirect on "System.Net.Http, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" is incorrect. Consider removing it from the application configuration file. The build will replace it with: "<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" xmlns="urn:schemas-microsoft-com:asm.v1" />".

To summarize, on hand, my application launches but my map is a blank page. On the other hand my app crashes when (maybe) it retrieves data from the internet.

Can somebody tell what's wrong with my code or my app?

Thanks


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>