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

Geolocation doesn't work iOS

$
0
0

I'm trying to get device location with help of this example https://github.com/XLabs/Xamarin-Forms-Labs/wiki/Geolocator. This works on simulators , but on iPad Air doesn't work. My info.plist file containing all necessary keys for location., NSLocationUsageDescription and NSLocationWhenInUseUsageDescription

in code

 if (this.manager.RespondsToSelector(new Selector("requestWhenInUseAuthorization")))
        {
            this.manager.RequestWhenInUseAuthorization();
        } 

piece of code where using Geolocator object..

 IGeolocator geolocator = null;
        geolocator = DependencyService.Get<IGeolocator>();
        if (geolocator != null)
        {
            if (geolocator.IsGeolocationEnabled)
            {
                try
                {
                    if (!geolocator.IsListening)
                        geolocator.StartListening(1000, 1000);

                    var task = await geolocator.GetPositionAsync(10000, CancellationToken.None);

                    if(task != null)
                    {
                        this.Position = task;
                    }

but LocationUpdated event never fire......

Location on device is on.

If anyone have similar issue....... please help..... Once, this work on simulators.

I use VS 2013, Xamarin 3.7, Xamarin.iOS 8.4 , iOS 8.1 on iPad Air.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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