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?
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?
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>
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];
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.