【问题标题】:iOS google places API - compile error - use of undeclared identifier GMSAutocompleteViewControlleriOS google Places API - 编译错误 - 使用未声明的标识符 GMSAutocompleteViewController
【发布时间】:2016-01-18 17:53:46
【问题描述】:

我已经使用 CocoaPods 安装了 GoogleMaps SDK。
对于某些屏幕,我需要使用 Google Places API
这是代码

GMSAutocompleteViewController *acController = [[GMSAutocompleteViewController alloc] init];
acController.delegate = self;
[self presentViewController:acController animated:YES completion:nil];

我从https://developers.google.com/places/ios-api/autocomplete 得到的
错误 - 使用未声明的标识符“GMSAutocompleteViewController”

【问题讨论】:

  • 也许你忘了导入实际的框架?
  • 谢谢,我做了,好像我没有更新框架。检查答案。

标签: ios objective-c google-places-api google-maps-sdk-ios


【解决方案1】:

您是否在文件中添加了#import <GoogleMaps/GoogleMaps.h>

另一种可能是您使用的是旧版本的 GoogleMaps pod(GMSAutocompleteViewController 是在 1.11 版中添加的)。要解决这个问题,只需运行

pod update

在项目目录中。

【讨论】:

  • 我已添加导入 GoogleMaps。我检查了 GoogleMaps 框架标题,发现 GMSAutocompleteViewController 不可用。更新了 pod,现在我明白了。谢谢。
  • 当我更新到 1.11 时,我遇到了这个 Pod 问题:code.google.com/p/gmaps-api-issues/issues/detail?id=9030 有什么建议吗?
  • 我建议根本不要将二进制工件检查到源代码管理中。没必要。
猜你喜欢
  • 2014-08-17
  • 1970-01-01
  • 2015-10-24
  • 2022-03-09
  • 1970-01-01
  • 1970-01-01
  • 2012-08-22
  • 1970-01-01
相关资源
最近更新 更多