未声明的标识符GMSAutocompleteViewContro

未声明的标识符GMSAutocompleteViewContro

本文介绍了iOS Google Places API-编译错误-使用未声明的标识符GMSAutocompleteViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

我从那里获得的信息https://developers.google.com/places/ios -api/autocomplete
错误-使用未声明的标识符'GMSAutocompleteViewController'

解决方案

您是否已将#import <GoogleMaps/GoogleMaps.h>添加到文件中?

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

pod update

在项目目录中.

I have installed GoogleMaps SDK using CocoaPods.
For some screen I need to use Google Places API
Here is the code

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

Which I have got from https://developers.google.com/places/ios-api/autocomplete
The error - use of undeclared identifier 'GMSAutocompleteViewController'

解决方案

Have you added #import <GoogleMaps/GoogleMaps.h> to the file?

The other possibility is that you have an older version of the GoogleMaps pod (GMSAutocompleteViewController was added in version 1.11). To fix this, just run

pod update

in the project directory.

这篇关于iOS Google Places API-编译错误-使用未声明的标识符GMSAutocompleteViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 06:15