我正在使用 iPhone sdk 4.0。我使用下面的代码来获取当前位置,但它的委托方法不是自动调用的......我的代码如下:
在.hfile
我有进口
CoreLocation/CoreLocation.h
也委托
CLLocationManagerDelegate
CLLocationManager *locationManager;
在.mfile
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 100 m
[locationManager startUpdatingLocation];
但我没有得到当前位置......我的委托方法是未调用的:
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
}