そこで、CLLocationManager を作成し、それを呼び出して更新を開始し、mapView.showsUserLocation を YES に設定し、userLocation アノテーションに対して nil を返しました。UIMapViewController のコードの一部を次に示します。
- (void)viewDidLoad
{
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
[locationManager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
CLLocationCoordinate2D userCoordinate = locationManager.location.coordinate;
[map setCenterCoordinate:userCoordinate animated:YES];
[map setShowsUserLocation:YES];
}
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
MKAnnotationView *mapIconView = (MKAnnotationView *) [mapView dequeueReusableAnnotationViewWithIdentifier:@"mapIconView"];
// Don't mess with the user location annotation
if (annotation == mapView.userLocation)
return nil;
// etc.
}
これはすべて非常に簡単に思えます。すべてが正常に機能します。マップは目的どおりに現在地にズームし、すべてのメソッドが期待どおりに呼び出されることを確認しましたが、青い点はありません。どこで何回言っても一生青い点は取れない
mapView.setUserLocation = YES;
ここで何が欠けていますか?