【发布时间】:2015-08-14 13:56:41
【问题描述】:
我使用的是 google map sdk 版本 1.9.1。
我想显示当前位置的地图。
这是我的代码。
@interface ViewController ()
{
GMSMapView *mapView_;
}
- (void)viewDidLoad {
[super viewDidLoad];
mapView_ = [GMSMapView mapWithFrame:CGRectMake(0.0f, 100.0f, 320.0f, 300.0f) camera:nil];
mapView_.myLocationEnabled = YES;
[self.view addSubview: mapView_];
}
但我无法显示当前位置。 感谢您的帮助。
【问题讨论】:
-
确保您的应用访问设备的位置:stackoverflow.com/questions/24062509/…。尝试设置 _yourMapView.settings.myLocationButton = YES 并点击此按钮?
-
我得到了位置,但它给了我错误的位置。它返回“旧金山”的位置@phuongle
-
让我们尝试其他解决方案,通过 CLLocationManager:didUpdateLocations 方法监听 Apple 位置。然后调用 [_mapView animateToLocation:CLLocationCoordinate2DMake(CLLocationDegrees latitude, CLLocationDegrees longitude)] 更新谷歌地图中的当前位置。
-
在 DidUpdate 位置我更新 ios 8.3 @phuongle 时位置错误