谷歌地图sdk在iPhone中显示方向

时间:2014-07-24 10:32:30

标签: ios iphone google-maps

我正在使用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 key或google map sdk的问题,我将其复制到我的项目中。

3 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:1)

在审核完您的代码后,我可以说以下内容:可能会帮助其他人

  1. 拖放您的GoogleMaps.framework,使其位于根文件夹中并显示在Build Phases - > Link Binary with Libraries
  2. enter image description here

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

    2. 添加所有框架,例如:

    3. enter image description here

答案 2 :(得分:0)

请同时添加此行

_markerStart.map = _mapView;

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