【问题标题】:GMSMapview current location marker not comingGMSMapview 当前位置标记未出现
【发布时间】:2016-04-20 09:07:19
【问题描述】:

我做了很多事情都无法找到解决这种情况的方法。在谷歌地图中,​​我当前的位置标记没有出现,只有地面覆盖。

我正在使用 Google 地图 SDK 1.13.0 。

    GMSMapView *mapView = [[GMSMapView alloc] init];
    mapView.tag = Tag_googleMapView;
    mapView.frame = CGRectMake(0.0, 0.0, view.frame.size.width,view.frame.size.height);
    mapView.delegate = self;
    mapView.indoorEnabled = YES;
    [mapView setMyLocationEnabled:YES];
    [mapView.settings setMyLocationButton:YES]; 

看起来像这样。

不正确的蓝色当前位置标记没有出现

【问题讨论】:

  • 你签入的是模拟器还是设备?
  • @Venkat 我正在检查两者
  • 检查这个 SO 问题 2619248024062509 如果它可以帮助你:)
  • @KENdi 我的位置管理器对象没有问题

标签: ios objective-c google-maps


【解决方案1】:

我遇到了这个问题。这是由于谷歌地图库没有通过 Cocoapods 正确包含在项目中的问题。如果使用 Cocoapods,请确保在 Build Settings > Preprocessor Macros 下的目标中设置了 COCOAPODS = 1 标志。我遇到了这个问题,因为在具有多个目标的项目中包含依赖项时,除非将 Pod 显式添加到 Podfile 中的每个目标,否则不会在所有目标中自动设置该标志。如果您有多个目标,您的 Podfile 应该类似于:

def map_pod
    source 'https://github.com/CocoaPods/Specs.git'
    pod 'GoogleMaps'
end

target 'target_1_name' do
    map_pod
end

target 'target_2_name' do
    map_pod
end

我认为位置图标没有正确显示,因为没有编译器标志,渲染它所需的库没有正确链接。

【讨论】:

  • 我检查了我的目标 > 构建设置,但所有字段值都设置正确
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-24
  • 2017-09-28
  • 1970-01-01
  • 2016-05-01
  • 1970-01-01
相关资源
最近更新 更多