2

I have an application with map and want to zoom to the current location, when it's updated.

I use -(void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation delegate method to know when user location was updated.

Now on simulator method is being called as it should. But when i test it on device (iphone 2g) the location is updated on map, but "didUpdateUserLocation" method is not being called at all, same for delegate method "mapViewWillStartLocatingUser".

The system asks if I allow to get my location for app and starts showing my location, but

- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation {
NSLog(@"didUpdateUserLocation = '%@'", userLocation);   

}

is never called.

Matteo Alessani
  • 10,264
  • 4
  • 40
  • 57
Moze
  • 333
  • 2
  • 15

2 Answers2

2

Reference mentions that this delegate method is available since iOS 4.0. Your simulator is most probably running iOS 4.0 while your phone - iOS 3.1.

I'm having the same problem and still looking for solution. Perhaps accessing CL methods directly will help.

kolinko
  • 1,633
  • 1
  • 14
  • 31
  • Thank you! I never thought that checking that. – Moze Jul 26 '10 at 08:16
  • I'm glad I helped. I solved the problem by quering for user location every second or so. If you find a better solution I'd appreciate you posting it here :) – kolinko Jul 26 '10 at 15:43
0

try this Map.showsUserLocation=YES;

ishank
  • 11
  • 1