没有在谷歌地图上显示当前位置?

时间:2015-06-01 07:26:35

标签: ios google-maps-sdk-ios

我正在使用谷歌地图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_];
}

但我无法显示当前位置。 感谢您的帮助。

2 个答案:

答案 0 :(得分:0)

您必须在

中设置您的位置

调试>位置>自定义幻灯片

enter image description here

如果您可以在设备中测试,请在设置屏幕中启用您的位置

答案 1 :(得分:0)

  1. 首先,您的应用必须要求获得访问ios8中用户位置的权限。请参阅此帖子:Location Services not working in iOS 8或此:iOS: App is not asking user's permission while installing the app. getting kCLAuthorizationStatusNotDetermined every time - Objective-c & Swift

  2. 之后,您调用位置管理器的[locationManager startUpdatingLocation]方法。

  3. 然后您将看到当前更新的位置。

相关问题