1

MKMapViewDelegate mapView:didUpdateUserLocation: method is not called when running on the 5.0 simulator, even if all location permissions are given in the device settings.

With 4.3 it's working fine.

Any ideas?

Gytis
  • 670
  • 6
  • 19

3 Answers3

0

I know it's an old thread. I'll answer anyway, it might help others too.

I had similar problem with iOS 6. Which I was able to solve by setting the mapview delegate to self.

Like this:

[mapView setDelegate:self];

Make sure your ViewController.h has the MKMapViewDelegate along the lines:

@interface ViewController : UIViewController <CLLocationManagerDelegate, MKMapViewDelegate>
e1on
  • 81
  • 3
0

I got the same thing after refactor to ARC.

First I had the following code in viewDidLoad;

CLLocationManager *lm =[[CLLocationManager alloc] init];
lm.delegate = self;
lm.desiredAccuracy = kCLLocationAccuracyBest;
[lm startUpdatingLocation];

I did the following in de headerfile

@interface ViewController : UIViewController <CLLocationManagerDelegate>
{
CLLocationManager *locationManager;
}

@property(nonatomic, strong)CLLocationManager *locationManager;

And

@synthesize locationManager;

The code I change in viewDidLoad

locationManager =[[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];
Martin
  • 271
  • 4
  • 9
0

Check "setUserTrackingMode:animated:" and "userTrackingMode". Both are new in the iOS5. I had a similar problem and fixed it by setting MKUserTrackingModeFollow in the setUserTrackingMode function. I think the default tracking mode is MKUserTrackingModeNone and only calls mapView:didUpdateUserLocation once.

If your problem is that the mapView:didUpdateUserLocation is never called, then take a look at the options in the new xcode, right below the console outputs there's an icon like the gps icon in the ipad, which lets you simulate a location.

David
  • 1
  • 1