Add the API key to your app

Swift

Add the following to your application(_:didFinishLaunchingWithOptions:)
method, replacing YOUR_API_KEY with your API key:

GMSServices.provideAPIKey("YOUR_API_KEY")

If you are also using the Places API, add your key again as shown here:

GMSPlacesClient.provideAPIKey("YOUR_API_KEY")

Objective-C

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

Add the following import statement:

@import GoogleMaps;

Add the following to your application:didFinishLaunchingWithOptions:
method, replacing YOUR_API_KEY with your API key:

[GMSServices provideAPIKey:@"YOUR_API_KEY"];

If you are also using the Places API, add your key again as shown here:

[GMSPlacesClient provideAPIKey:@"YOUR_API_KEY"];

Restrict the API key

We strongly recommend that you restrict your API key. Restrictions provide added security and help
ensure only authorized requests are made with your API key. There are two restrictions. You should
set both:

Application restriction: Limits usage of the API key to a specific web site
(HTTP referrers), web server (IP addresses), or mobile app (Android apps or iOS apps). You can
select only one restriction from this category (see GMP APIs by Platform).

API restriction: Limits usage of the API key to one or more APIs or SDKs.
Requests to an API or SDK associated with the API key will be processed.
Requests to an API or SDK not associated with the API key will fail. (The API or SDK must be
enabled and must support the
application restriction.)

Premium Plan customers

Click the project drop-down and select the project created for you when you
purchased theGoogle Maps APIs Premium Plan. The project name starts with
Google Maps APIs for Business or Google Maps for Work or Google Maps.