iOS - 目标 - C Google Maps 使用未声明的标识符

标签 ios objective-c google-maps geocoding google-geocoder

所以我对使用谷歌地图比较陌生,我不知道我做错了什么。正如我在关注 Google Maps - iOS documentation .在 Camera Position 的副标题下,我使用了这段代码:

- (void)mapView:(GMSMapView *)mapView
    idleAtCameraPosition:(GMSCameraPosition *)cameraPosition {
        id handler = ^(GMSReverseGeocodeResponse *response, NSError *error) {
         if (error == nil) {
         GMSReverseGeocodeResult *result = response.firstResult;
         GMSMarker *marker = [GMSMarker markerWithPosition:cameraPosition.target];
         marker.title = result.lines[0];
         marker.snippet = result.lines[1];
         marker.map = mapView;
      }
    };
  [geocoder_ reverseGeocodeCoordinate:cameraPosition.target completionHandler:handler];
  }

主要问题是最后一行。
[geocoder_ reverseGeocodeCoordinate:cameraPosition.target completionHandler:handler];

由于 Xcode 给了我以下错误 - “使用未声明的标识符 'geocoder_'”

为什么会出现这种情况?

最佳答案

您需要声明变量 geocoder_ :

GMSGeocoder *geocoder_ = [GMSGeocoder geocoder];

https://developers.google.com/maps/documentation/ios-sdk/reference/interface_g_m_s_geocoder

关于iOS - 目标 - C Google Maps 使用未声明的标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33459558/

相关文章:

ios - 如何使用 AFnetworking 图像缓存刷新 iOS 谷歌地图中的标记信息窗口?

javascript - 如何按名称将 Google map 置于国家/地区的中心

ios - 在更新 iOS 应用程序时,强制覆盖/删除文档中的 plist?

ios - 带有有序键的 NSDictionary

ios - 一个有争议的类似委托(delegate)的事件通知模式

objective-c - (xcode 5) ibtool 失败,退出代码为 255

android - 带有Gradle的Android Google Maps API v1

iphone - iPhone 版 UnRar 库 - 受密码保护的 Rar 文件

ios - UICollectionView 到 UICollectionViewCell

ios - MPMediaPlayerController 永久隐藏用户界面元素