You're all set!

To start developing, please head over to our developer documentation.

Activate the Google Places API for iOS

To get you started we'll guide you through the Google Developers Console to do a few things first:

  1. Create or choose a project
  2. Activate the Google Places API for iOS
  3. Create appropriate keys
Continue

Code Samples Overview

The SDK demo apps supplied with the Google Places API for iOS include a sample app for the place picker UI widget. In addition, you can find code snippets on each page of this developer's guide.

Try the SDK demos using CocoaPods

The Google Places API for iOS is packaged with the Google Maps SDK for iOS, and is available as a CocoaPods pod. CocoaPods is an open source dependency manager for Swift and Objective-C Cocoa projects.

The Google Places API for iOS supplies a set of SDK demo apps that you can install and run using the pod try GoogleMaps command. Follow these steps to install CocoaPods and try the Google Places API for iOS.

  • If you don't already have the CocoaPods tool, install it on OS X by running the following command from the terminal. For details, see the CocoaPods Getting Started guide.
    $ sudo gem install cocoapods
  • Open a terminal window and run the following command:
    $ pod try GoogleMaps

    CocoaPods updates your spec repositories, then opens the SDK demos in a temporary Xcode project, SDKDemos.xcodeproj.

  • In Xcode, press the compile button to build and then run the current scheme. The build produces an error, showing a User-Defined Issue in the SDKDemoAPIKey.h file.
  • If you don't yet have an API key, follow the instructions to set up a project on the Google Developers Console and get an API key. When configuring the key on the Google Developers Console, you can specify your app's bundle identifier to ensure that only your app can use the key. The default bundle identifier of the SDK samples app is com.example.SDKDemos.
  • Edit the SDKDemoAPIKey.h file and paste your API key into the definition of the kAPIKey constant. For example:
    static NSString *const kAPIKey = @"YOUR_API_KEY";
  • If Xcode prompts you to unlock the SDKDemoAPIKey.h file for editing, choose Unlock.
  • Remove the following line, because it's used to register the user-defined issue:
    #error Register for API Key and insert here.
  • Build and run the project again.
  • If prompted to allow the Xcode app to accept incoming network connections, choose Allow. The iOS simulator window appears, showing a list of Maps SDK Demos.
  • Choose Places API Place Picker to try the place picker UI widget supplied by the Google Places API for iOS.
  • If prompted to allow SDK Demos to access your location, choose Allow.
  • Play with the place picker. Try panning the map, then select a place and see the place details (name, coordinate, address, and more) for the selected place.

Use code snippets from the developer's guide

Each page in the developer's guide includes code snippets illustrating a particular feature of the API. For example, see the guides for place picker, autocomplete, get current place, and other pages in this guide.

Send feedback about...

location_on
Google Places API for iOS