Имам MKMapView, конфигуриран така:
mapView = [[MKMapView alloc] init];
[mapView setMapType:MKMapTypeStandard];
[mapView setShowsUserLocation:YES];
[mapView setDelegate:self];
След това инициализирам CLLocationManager и извиквам startUpdatingLocation.
Използвам iSimulate, за да изпратя GPS данните от телефона си към симулатора, който изглежда работи тъй като методът на делегат CLLocationManager се извиква с моите правилни GPS координати. MKMapView обаче никога не премества синята точка от Купертино.
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation {
NSLog(@"Did Update Location = %f / %f", [newLocation coordinate].latitude, [newLocation coordinate].longitude);
NSLog(@"Current User Location = %f / %f", [[mapView userLocation] coordinate].latitude, [[mapView userLocation] coordinate].longitude);
}
Горният метод извежда следното:
>>> Did Update Location = 40.740100 / -73.989900 # Correct
>>> Current User Location = 37.331693 / -122.030457 # Cupertino... Incorrect
Дори ако ръчно актуализирам координатите на userLocation с помощта на:
[[mapView userLocation] setCoordinate:[newLocation coordinate]];
Точката все още стои само върху Купертино. Изпускам ли нещо?