我遵循了许多教程,但都没有工作。坐标始终输出0.000000,0.000000。目标c GPS坐标不起作用
这里是我的位置代码:
- (void)locationManager:(CLLocationManager *)manager
didUpdateLocations:(NSArray *)locations
{
currentLocation = (CLLocation *)[locations lastObject];
}
-(void)getLocation {
longitude = floorf(currentLocation.coordinate.longitude * 10000)/10000;
}
我有这样的一个按钮:
locationManager stopUpdatingLocation];
[self getLocation];
而且我有这个在viewDidLoad中:
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
[locationManager startUpdatingLocation];
我在xcode的ios模拟器中使用假的位置,所以它不应该输出0.000000。
我现在无法在设备上运行。但我会给这个镜头。 –
雅没有工作。它没有显示授权弹出。 –
见编辑@GeorgeYoung –