Two example apps used for product support with Google's iOS Map SDK
- Download and install XCode
- Install cocoapods on MacOS using
sudo gem install cocoapods
if you don't already have it - From the base directory do both
cd ../GMS\ Normal\ App
andcd ../GMS\ iMessage\ App
and follow the steps below for both the iMessage and Normal directories pod install
- open the
.xcworkspace
file in either directory - Change the bundle identifier and development team to your own in .xcodeproj > Targets > General
- Ensure that your Maps API key is permitted to run the declared bundles
- For the Normal app, go to "GMS Normal App > ViewController.swift" and include your Maps-enabled API key as the apiKey variable. For the iMessage app, go to "GMS iMessage App MessagesExtension > MessagesViewController.swift" and include your Maps-enabled API key as the apiKey variable
- Run either application on a connected mobile device (untested on simulator)
When running the normal app, the view should look as expected: a Google map focused on Sydney Australia with a marker
When running the iMessage app, the view fails to load the map and simply shows the google icon upon a grey map.
- Create two new XCode projects directly in Xcode, specifying an "App" for the normal app and an "iMessage extension" for the iMessage app
- Add pod files specifying the installation of GoogleMaps,
pod install
, and open the generated .xcworkspace files - Specifically for the iMessage app, go to ".xcodeproj > Targets > GMS iMessage App MessagesExtension > Build Settings > Other Linker Flags" and add
-framework "GoogleMaps" -framework "GoogleMapsBase" -framework "GoogleMapsCore"
. This step is necessary as pod install doesn't link the google maps frameworks to Message Extension targets. - Add code from https://developers.google.com/maps/documentation/ios-sdk/map-with-marker?authuser=2 to the view controllers. Note that although the tutorial specifies that the api key should be provided in the AppDelegate file, I have provided the API key in the viewDidLoad of the sole view controllers since Message Apps lack an AppDelegate file.
- Include your API key in the apiKey variable on each view controller. Then, check to ensure the api key is declared to work for both bundle identifiers and run.