1
我有下面几行代码来定位我的位置,但我总是得到相同的位置,无论我在哪里:CLLocationManager始终位于伦敦
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.distanceFilter = kCLDistanceFilterNone;
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
[locationManager startUpdatingLocation];
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
CLLocation *location = [locations lastObject];
self.lati = [NSString stringWithFormat:@"%f",location.coordinate.latitude];
self.longi = [NSString stringWithFormat:@"%f",location.coordinate.longitude];
[locationManager stopUpdatingLocation];
locationManager.delegate = nil;
}
你在设备测试?或模拟器?您正在测试哪个iOS版本的 – Venkat 2013-02-20 11:49:11
? – tkanzakic 2013-02-20 11:49:59
设备,ios 6.2.1 – davidOhara 2013-02-20 11:50:23