Search code examples
iosobjective-cgoogle-places-apigoogle-maps-sdk-ios

iOS google places API - compile error - use of undeclared identifier GMSAutocompleteViewController


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'


Solution

  • 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.