【问题标题】:Google map sdk to show direction in iPhone谷歌地图 SDK 在 iPhone 中显示方向
【发布时间】:2014-07-29 21:21:44
【问题描述】:

我正在使用 Googlemap sdk 在我的应用程序中显示方向,我已经下载了一个示例应用程序。我已将所有功能集成到我的应用程序中。但是地图没有显示。下面是我正在使用的代码。

  GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:9.96 longitude:76.31 zoom:12];
_mapView = [GMSMapView mapWithFrame:self.view.bounds camera:camera];


_mapView.myLocationEnabled = YES;
_mapView.delegate = self;
[self.view addSubview:_mapView];

_markerStart = [GMSMarker new];
_markerStart.title = @"Raj";
_markerStart.snippet=@"2Km";
_markerStart.icon = [GMSMarker markerImageWithColor:[UIColor greenColor]];

在上面的代码中,_mapView 越来越为零,这是关于我复制到我的项目中的 api 密钥或 google map sdk 的问题吗?

【问题讨论】:

  • 试试这一行:mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
  • 已经试过了,这个代码在示例项目中工作。问题不在于框架,GMSMapView 是空的。
  • 我已经尝试过同样适用于我的东西.. 你有 -> GoogleMaps.framework->Resources ->GoogleMaps.bundle 单独添加到你的框架中
  • 是的,我已将该捆绑包添加到我的项目中,地图未显示
  • 如果可能的话,请你把你的项目分享给谷歌驱动器吗??

标签: ios iphone google-maps


【解决方案1】:

查看您的代码后,我可以说:可能会帮助其他人

  1. 拖放GoogleMaps.framework,使其位于根文件夹并显示在Build Phases -> Link Binary with Libraries

  1. GoogleMaps.framework->Resources 添加 GoogleMaps.bundle -> GoogleMaps.bundle

  2. 添加所有框架,如:

【讨论】:

    【解决方案2】:

    检查是否添加了所有框架。 通过此链接https://developers.google.com/maps/documentation/ios/start

    【讨论】:

      【解决方案3】:

      请也添加此行

      _markerStart.map = _mapView;
      

      再试一次..可能会有帮助..

      【讨论】:

      • 这不是问题,
      • _mapView = [GMSMapView mapWithFrame:self.view.bounds camera:camera];//_mapView 无断点检查
      • 不,这不是问题,我为示例应用程序提供了错误的密钥。那里的地图不为空
      • 是的,但它仍然显示地图。我给出了正确的包标识符
      猜你喜欢
      • 2011-07-03
      • 1970-01-01
      • 1970-01-01
      • 2016-08-11
      • 1970-01-01
      • 2015-05-29
      • 2016-09-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多