Your Google Maps APIs Premium Plan license provides enhanced support for the Google Maps SDK for iOS. This document tells you how to create an iOS app that uses the Google Maps SDK for iOS with the Premium Plan.
Overview
Follow the instructions on this page to download the SDK, set up your project, and add a map. Here is a summary of the steps required:
- Download the SDK.
- Add the SDK and its dependencies to your application.
- Add your API key to your
AppDelegate. - Add a map.
Download the SDK
The Google Maps SDK for iOS for Google Maps APIs Premium Plan customers is distributed as a zip file containing a static framework. After downloading the SDK, you will need to obtain an API key before you can add a map to your application.
Add the SDK to your project
The Google Maps SDK for iOS available with the Premium Plan is shipped as a static framework with an included resource bundle. Before you can add a map to your application, you must add the framework to your project and configure your build settings in Xcode. These instructions assume an installation for a new project.
- 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 but ensure that Use Automatic Reference Counting is on.
- Drag the
GoogleMapsM4B.frameworkbundle into your project. When prompted, select Copy items if needed. - Right-click
GoogleMapsM4B.frameworkin your project, and select Show In Finder. - Drag the
GoogleMaps.bundlefrom theResourcesfolder into your project. When prompted, ensure Copy items into destination group's folder is not selected. - Select your project from the Project Navigator, and choose your application's target.
- Open the Build Phases tab, and within Link Binary with Libraries, add
the following frameworks:
- Accelerate.framework
- AVFoundation.framework
- CoreBluetooth.framework
- CoreData.framework
- CoreGraphics.framework
- CoreLocation.framework
- CoreText.framework
- GLKit.framework
- ImageIO.framework
- libc++.dylib
- libicucore.dylib
- libz.dylib
- OpenGLES.framework
- QuartzCore.framework
- Security.framework
- SystemConfiguration.framework
- Choose your project, rather than a specific target, and open the
Build Settings tab.
- Replace the default value of Architectures with
armv7. - 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.
- Replace the default value of Architectures with
Add your API key to your app
Get an API key from the Google Developers Console
To authenticate your app to the Google Maps SDK for iOS, you need a combination of an app-specific bundle identifier and an API key. The type of API key you need is an iOS key.
If your Google Maps Premium project doesn't already have an iOS key (a type of API key), follow these steps to create a new API key from the Google Developers Console:
- Go to the Google Developers Console.
- From the Project drop-down menu, select the Google Maps Premium project.*
- Click Continue.
- On the Credentials page, get an iOS key and set the API
credentials.
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. - Enter your app's bundle identifier when prompted. For example:
com.example.hellomap. 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 Developers Console.
For more information, see Developers Console Help.
Add the API key to your app
Add the API key to your AppDelegate.m as follows:
- Add the following import statement:
#import <GoogleMapsM4B/GoogleMaps.h>
- Add the following to your
application:didFinishLaunchingWithOptions:method, replacing YOUR_API_KEY with your API key:[GMSServices provideAPIKey:@"YOUR_API_KEY"];
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.
#import "YourViewController.h"
#import <GoogleMapsM4B/GoogleMaps.h>
@implementation YourViewController {
GMSMapView *mapView_;
}
// 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];
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_;
}
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.
More information
How to migrate an existing app
The Google Maps SDK for iOS available with the Premium Plan has been designed to be very similar to the standard Google Maps SDK for iOS. Consequently, the migration process is straightforward.
- Download the Google Maps SDK for iOS for the Premium Plan, as described above.
- Generate a new API key for your project.
- Remove the Google Maps SDK for iOS from your application:
- Open your project in Xcode.
- In the Project Navigator, locate
GoogleMaps.framework. - Right-click on
GoogleMaps.frameworkand choose Delete. - Locate and remove
GoogleMaps.bundlein the same way.
- Add the new Google Maps SDK for iOS for the
Premium Plan to your application:
- Drag the
GoogleMapsM4B.frameworkbundle into your project. When prompted, select Copy items if needed. - Right-click
GoogleMapsM4B.frameworkin your project, and select Show In Finder. - Drag the
GoogleMaps.bundlefrom theResourcesfolder to your project. When prompted, ensure Copy items into destination group's folder is not selected.
- Drag the
- In each place where you import
GoogleMaps.h, update the reference fromGoogleMaps/GoogleMaps.hto the newGoogleMapsM4B/GoogleMaps.h. - Build your application.
Google Places API for iOS
The Google Maps SDK for iOS includes classes belonging to the Google Places API for iOS.
Note: You are free to use the Google Places API for iOS in your project, but this API is not covered by your Google Maps APIs Premium Plan license. This means that the Google Places API for iOS is not covered by the enhanced support or SLA purchased with the Google Maps APIs Premium Plan license, and any usage is governed by the terms of service of the free API and will not be counted towards your Google Maps APIs Premium Plan quota. Please contact your Google representative for more information about enabling the Google Places API for iOS.Attribution requirements
You must include the attribution text as part of a legal notices section in your application. Google recommends including legal notices as an independent menu item, or as part of an "About" menu item.
You can get the attribution text by making a call to
[GMSServices openSourceLicenseInfo].
Supported platforms
Developing an iOS application with the Google Maps SDK for iOS distributed with the Premium Plan requires the following:
- Xcode 6.3.0 or later.
- iOS SDK 7.1 or later.
Applications developed with this SDK will work on iOS 7.0 and later.
Comparing versions
The following table describes the key differences between the using standard Google Maps SDK for iOS and using the SDK with the Premium Plan.
| Standard Google Maps SDK for iOS | Premium Plan | |
|---|---|---|
| Framework Name | GoogleMaps/GoogleMaps.h |
GoogleMapsM4B/GoogleMaps.h |
| Support Channels | Community based support. | Access to Premium support. |
| Terms | Subject to the Google Maps/Google Earth APIs Terms of Service. | Subject to Google Maps APIs Premium Plan terms of use. |
Documentation
The main source of information about the Google Maps SDK for iOS is the developer and reference documentation available elsewhere on our site.
