You're all set!

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

Activate the Google Maps SDK 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 Maps SDK for iOS
  3. Create appropriate keys
Continue

Getting Started

Before you can begin working with Google Maps on iOS, you need to download the Google Maps SDK for iOS and ensure that you have an API key.

Complete release notes are available for each release.

If you are using the Google Maps SDK for iOS with a Google Maps APIs Premium Plan license, see the Premium Plan getting-started guide instead.

Step 1: Get the latest version of Xcode

To build a project using the Google Maps SDK for iOS, you need version 7.0 or later of Xcode.

Step 2: Install the SDK

Use CocoaPods

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

If you don't already have the CocoaPods tool, install it on macOS by running the following command from the terminal. For details, see the CocoaPods Getting Started guide.

sudo gem install cocoapods

Create a Podfile for the Google Maps SDK for iOS and use it to install the API and its dependencies:

  1. If you don't have an Xcode project yet, create one now and save it to your local machine. (If you're new to iOS development, create a Single View Application.)
  2. Create a file named Podfile in your project directory. This file defines your project's dependencies.
  3. Edit the Podfile and add your dependencies. Here is an example which includes the dependencies you need for the Google Maps SDK for iOS and Places API for iOS (optional):
    source 'https://github.com/CocoaPods/Specs.git'
    target 'YOUR_APPLICATION_TARGET_NAME_HERE' do
      pod 'GoogleMaps'
      pod 'GooglePlaces'
    end

    Premium Plan customers must also add: pod 'GoogleMaps/M4B'.

  4. Save the Podfile.
  5. Open a terminal and go to the directory containing the Podfile:

    cd <path-to-project>
  6. Run the pod install command. This will install the APIs specified in the Podfile, along with any dependencies they may have.

    pod install
  7. Close Xcode, and then open (double-click) your project's .xcworkspace file to launch Xcode. From this time onwards, you must use the .xcworkspace file to open the project.

Install manually

This guide shows how to manually add the GoogleMaps framework to your project and configure your build settings in Xcode.

  1. Download the SDK source files: GoogleMaps-2.0.1.
  2. Unpack the source files.
  3. Launch Xcode and either open an existing project, or create a new project. If you're new to iOS, create a Single View Application, and disable Use Storyboards and enable Use Automatic Reference Counting.
  4. Drag the following bundles into your project (when prompted, select Copy items if needed):
    • Subspecs/Base/Frameworks/GoogleMapsBase.framework
    • Subspecs/Maps/Frameworks/GoogleMaps.framework
    • Subspecs/Maps/Frameworks/GoogleMapsCore.framework

    Premium Plan customers must also include Subspecs/M4B/Frameworks/GoogleMapsM4B.framework.

  5. Right-click GoogleMaps.framework in your project, and select Show In Finder.
  6. Drag the GoogleMaps.bundle from the Resources folder into your project. When prompted, ensure Copy items into destination group's folder is not selected.
  7. Select your project from the Project Navigator, and choose your application's target.
  8. Open the Build Phases tab, and within Link Binary with Libraries, add the following frameworks:
    • GoogleMapsBase.framework
    • GoogleMaps.framework
    • GoogleMapsCore.framework
    • GoogleMapsM4B.framework (Premium Plan customers only)
    • Accelerate.framework
    • CoreData.framework
    • CoreGraphics.framework
    • CoreLocation.framework
    • CoreText.framework
    • GLKit.framework
    • ImageIO.framework
    • libc++.dylib
    • libz.dylib
    • OpenGLES.framework
    • QuartzCore.framework
    • SystemConfiguration.framework
    • UIKit.framework
  9. Choose your project, rather than a specific target, and open the Build Settings tab. In the Other Linker Flags section, add -ObjC. If these settings are not visible, change the filter in the Build Settings bar from Basic to All.

  10. To install the Places API for iOS, see Get Started with the Places API for iOS.

Step 4: Get an API key

Follow these steps to enable the Google Maps SDK for iOS on the Google API Console. If your project doesn't already have an iOS key (a type of API key), these instructions also help you create a new API key.

  1. Go to the Google API Console.
  2. Create or select a project.
  3. Click Continue to enable the Google Maps SDK for iOS.
  4. On the Credentials page, get an iOS key and enter your app's bundle identifier when prompted. For example: com.example.hellomaps.
    Note: If you have an existing iOS key, you may use that key. You can use the same key with any of your iOS applications within the same project.
  5. Click Create.

    Your new iOS key appears in the list of API keys for your project. An API key is a string of characters, something like this:

    AIzaSyBdVl-cTICSwYKrZ95SuvNw7dbMuDt1KG0

You can also look up an existing key in the Google API Console.

For more information, see API Console Help.

Step 5: Add the API key to your application

Objective-C

Add your API key to your AppDelegate.m as follows:

  1. Add the following import statement:
    @import GoogleMaps;
  2. Add the following to your application:didFinishLaunchingWithOptions: method, replacing YOUR_API_KEY with your API key:
    [GMSServices provideAPIKey:@"YOUR_API_KEY"];
  3. If you are also using the Places API, add your key again as shown here:
    [GMSPlacesClient provideAPIKey:@"YOUR_API_KEY"];

Swift

Add your API key to your AppDelegate.swift as follows:

  1. Add the following import statement:
    import GoogleMaps
  2. Add the following to your application(_:didFinishLaunchingWithOptions:) method, replacing YOUR_API_KEY with your API key:
    GMSServices.provideAPIKey("YOUR_API_KEY")
  3. If you are also using the Places API, add your key again as shown here:
    GMSPlacesClient.provideAPIKey("YOUR_API_KEY")

Step 6: Add a map

The code below demonstrates how to add a simple map to an existing ViewController. If you're creating a new app, first follow the installation instructions above, and create a new Single View Application; disabling Use Storyboards but enabling Use Automatic Reference Counting (ARC).

Now, add or update a few methods inside your app's default ViewController to create and initialize an instance of GMSMapView.

Objective-C

#import "YourViewController.h"
#import <GoogleMaps/GoogleMaps.h>

@implementation YourViewController

// You don't need to modify the default initWithNibName:bundle: method.

- (void)loadView {
  // Create a GMSCameraPosition that tells the map to display the
  // coordinate -33.86,151.20 at zoom level 6.
  GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
                                                          longitude:151.20
                                                               zoom:6];
  GMSMapView *mapView = [GMSMapView mapWithFrame:CGRectZero camera:camera];
  mapView.myLocationEnabled = YES;
  self.view = mapView;

  // Creates a marker in the center of the map.
  GMSMarker *marker = [[GMSMarker alloc] init];
  marker.position = CLLocationCoordinate2DMake(-33.86, 151.20);
  marker.title = @"Sydney";
  marker.snippet = @"Australia";
  marker.map = mapView;
}

@end

Swift

import UIKit
import GoogleMaps

class YourViewController: UIViewController {

  // You don't need to modify the default init(nibName:bundle:) method.

  override func loadView() {
    // Create a GMSCameraPosition that tells the map to display the
    // coordinate -33.86,151.20 at zoom level 6.
    let camera = GMSCameraPosition.cameraWithLatitude(-33.86, longitude: 151.20, zoom: 6.0)
    let mapView = GMSMapView.mapWithFrame(CGRect.zero, camera: camera)
    mapView.myLocationEnabled = true
    view = mapView

    // Creates a marker in the center of the map.
    let marker = GMSMarker()
    marker.position = CLLocationCoordinate2D(latitude: -33.86, longitude: 151.20)
    marker.title = "Sydney"
    marker.snippet = "Australia"
    marker.map = mapView
  }
}

Run your application. You should see a map with a single marker centered over Sydney, Australia. If you see the marker, but the map is not visible, confirm that you have provided your API key.

Step 7: Declare the URL schemes used by the API

With iOS 9 and Xcode 7, apps must declare the URL schemes that they intend to open, by specifying the schemes in the app's Info.plist file. The Google Maps SDK for iOS opens the Google Maps mobile app when the user clicks the Google logo on the map, and your app therefore needs to declare the relevant URL schemes.

To declare the URL schemes used by the Google Maps SDK for iOS, add the following lines to your Info.plist:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>googlechromes</string>
    <string>comgooglemaps</string>
</array>

The following screenshot shows the configuration in the Xcode user interface:

LSApplicationQueriesSchemes configuration in Xcode

Without the above declaration, the following errors occur when the user taps the Google logo on the map:

-canOpenURL: failed for URL: "comgooglemaps://" - error: "This app is not allowed to query for scheme comgooglemaps"
-canOpenURL: failed for URL: "googlechromes://" - error: "This app is not allowed to query for scheme googlechromes"

To eliminate these errors, add the declaration to your Info.plist as described above.

Experiment with the Google Maps SDK demo project

Try the SDK demos using pod try GoogleMaps. For more details, see the guide to code samples.

Upgrade from an earlier version

Follow these instructions to upgrade an existing project to the most recent version of the Google Maps SDK for iOS.

If you previously installed the Google Maps SDK for iOS from a zip file containing a static framework:

  1. Remove all references to the previous framework from your Xcode project.
  2. Follow the instructions above to install the Google Maps SDK for iOS using CocoaPods.
  3. Make any necessary changes as a result of the upgrade. See the release notes for a list of the changes in each release.
  4. Clean and rebuild your project by selecting Product > Clean and then Product > Build.

If you previously installed the Google Maps SDK for iOS from the Google-Maps-iOS-SDK pod:

  1. Change your pod name to GoogleMaps.
  2. Run pod install.
  3. Make any necessary changes as a result of the upgrade. See the release notes for a list of the changes in each release.
  4. Clean and rebuild your project by selecting Product > Clean and then Product > Build.

If you previously installed the Google Maps SDK for iOS from the GoogleMaps pod:

  1. Check your Podfile for any version limiter, and ensure you remove or update the version to ensure you get the version you need. See the release notes for a list of version numbers.
  2. Run pod update.
  3. Make any necessary changes as a result of the upgrade. See the release notes for a list of the changes in each release.
  4. Clean and rebuild your project by selecting Product > Clean and then Product > Build.

Send feedback about...

Google Maps SDK for iOS
Google Maps SDK for iOS
Need help? Visit our support page.