Using Google maps in iOS | Using Google maps in iOS – Page 2015 – Zachary Powell
Zachary Powell

Software Programmer

Zachary Powell

Download my CV Send me a Message

Using Google maps in iOS

Zachary Powell - 30/12/2015

Today, we will look at setting up and using the Google Maps SDK on iOS devices. This leads on from our look at doing the same on Android HERE.

Setting up

First and foremost, make sure you have the most up to date version of Xcode. The Google Maps SDK only works for version 6.3 and above. The current version is 7.2 and I would recommend using this version for iOS 9 support.

To install the Google Maps SDK, we will be using CocoaPods. CocoaPods is an open source dependency manager for both Swift and Objective-C projects. If you don’t already have cocoapods installed, please do so now by opening a terminal and typing the below command:

sudo gem install cocoapods


If you are not using a pre existing project, now is the time to create one. Create a simple Single View Application.

Screen Shot 2015-12-21 at 20.21.08

Next we need to create a file called Podfile in the project directory. This file defines our projects dependencies, which in this case will be Google Maps. Open this file and give it the below contents:

source ''
platform :ios, '8.1'
pod 'GoogleMaps'

Save this file and then open a terminal within the directory containing the Podfile.

in this directory run the below command:

pod install

This will install the Google Map SDK for us. Once complete, 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.

Get API Key

Getting the key is pretty straight forward, but best described in the official guide from Google. Check out the details HERE

Using Map

Below is the most simple map set up we can do (future posts will look at more advanced features).

#import "YourViewController.h"
@import GoogleMaps;

@implementation YourViewController {
  GMSMapView *mapView_;

- (void)viewDidLoad {
  GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
  mapView_ = [GMSMapView mapWithFrame:CGRectZero camera:camera];
  self.view = mapView_;


So we import the GoogleMaps library, then we create a GMSMapView object. This allows us to create a view within the ViewController that will display the Map on the Screen.

Then, we create a CameraPosition object. Initialising the Map with this will make the map display at that location and zoom level.

And thats it the most simple Google Map created.

As always if you have any questions leave them below.

Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Tags: ,

“ Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ”

-Martin Fowler