0
votes

In Xamarin Forms, does the IsShowingUser property of Xamarin.Forms.Maps work for iOS?

I can get every aspect of my map to work on both Android and iOS, but the current location 'blue dot' does not show on iOS.

I'm setting this in shared code in the PCL project, just after successfully asking for permission to use location.

var status = await CrossPermissions.Current.CheckPermissionStatusAsync(Permission.Location);
            if (status != PermissionStatus.Granted)
            {
                var results = await CrossPermissions.Current.RequestPermissionsAsync(new[] { Permission.Location });
                status = results[Permission.Location];
            }

            if (status == PermissionStatus.Granted)
            {
                MyMap.IsShowingUser = true;
            }

thanks

1
I am also facing the same issue, did you get the answer. And also in my ios app the user current location button is not showing .but i am set the IsShowing=true - Aswathy K R
See the accepted answer, it did the job for me - DarkW1nter

1 Answers

2
votes

I can get every aspect of my map to work on both Android and iOS, but the current location 'blue dot' does not show on iOS.

It is because the map doesn't locate the current user location at that time, you can use Xam.Plugin.Geolocator to get your current location, and move the map to it.

var locator = CrossGeolocator.Current;
var position = await locator.GetPositionAsync(TimeSpan.FromSeconds(10));
map.MoveToRegion(MapSpan.FromCenterAndRadius(new Position(position.Latitude, position.Longitude),
                                                     Distance.FromMiles(1)));