所以我对使用谷歌地图比较陌生,我不知道我做错了什么。正如我在关注 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/