我目前正在使用地图功能,我得到当前位置并显示。现在我在 iOS4 中运行我的应用程序。在 iOS4 中运行应用程序时,CLLocationManger 委托方法未调用。但我可以在旧版本的 Xcode 3.1.4 中运行我的应用程序。它工作正常,委托方法也被正确调用。那么如何在 iOS4 中调用 CLLocationManger 委托方法呢?这对我来说很奇怪。
- (void)locationManager: (CLLocationManager *)manager didUpdateToLocation: (CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
NSLog(@"inside didUpdateToLocation");
MKCoordinateRegion region1;
region1.center = newLocation.coordinate;
region1.span.latitudeDelta = 0.001;
region1.span.longitudeDelta = 0.001;
mapview.mapType = MKMapTypeStandard;
[mapview setRegion:region1 animated:TRUE];
[locationManager stopUpdatingLocation];
}
请帮帮我。
谢谢。