Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Location service not longer working

ignaciomachinignaciomachin USMember ✭✭


I have this code that just to work fine to get location updates, then from a time being, the code is not working, the LocationsUpdated method is never called.

The CLLocationManager.Status property has a value of "Not Determined" even after I went to Settings/Privacy and enabled the location service for my app.

Not sure where to look next, any ideas?



    LocationManager = new CLLocationManager ();

    public void AddLocationToOrder (Order order)
        LocationManager.Delegate = new LocationDelegate (order);
        LocationManager.StartUpdatingLocation ();

    private class LocationDelegate : CLLocationManagerDelegate
        Order order;
        InvoicePayment payment;

        public LocationDelegate (Order order) : base()
            this.order = order;

        public LocationDelegate (InvoicePayment payment) : base()
            this.payment = payment;

        public override void LocationsUpdated (CLLocationManager manager, CLLocation[] locations)
            if (locations.Length > 0) {
                CLLocation current = locations[ locations.Length-1];
                if (current!=null){
                    if (order != null) {
                        order.Latitude = current.Coordinate.Latitude;
                        order.Longitude = current.Coordinate.Longitude;
                    AppDelegate.Current.Manager.LocationManager.StopUpdatingLocation ();

Best Answer


Sign In or Register to comment.