【发布时间】:2011-03-30 07:26:22
【问题描述】:
我正在使用 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
{
}
【问题讨论】:
-
尝试安装到 iphone 上,因为代码看起来没问题。