Get the iOS Consumer SDK

Select platform: Android iOS JavaScript

To follow on-demand trips in your iOS consumer apps, use the Consumer SDK. For more information on and an introduction to following trips using journey sharing, see Follow a trip in iOS.

To set up the Consumer SDK for your iOS consumer app, follow these steps:

  1. Check the minimum system requirements.
  2. Get the Consumer SDK.
  3. Inspect Apple Privacy Manifest file.
  4. Configure a Google Cloud Console project.
  5. Get authentication tokens.
  6. Initialize the Consumer SDK.

Check the minimum system requirements

Check the release notes for the minimum requirements for the version of the Consumer SDK you are using. See Release notes.

  • The mobile device must be running iOS 14 or later.
  • Apple Xcode version 15 or later.

Get the Consumer SDK

You install and configure the Consumer SDK with CocoaPods.

Swift Package Manager

The Consumer SDK can be installed via Swift Package Manager. To add the SDK, ensure you have removed any existing Consumer SDK dependencies.

To add the SDK to a new or existing project, follow these steps:

  1. Open your Xcode project or workspace, then go to File > Add Package Dependencies.
  2. Enter https://github.com/googlemaps/ios-consumer-sdk as the URL, press Enter to pull in the package, and click "Add Package".
  3. To install a specific version, set the Dependency Rule field to one of the version-based options. For new projects, we recommend specifying the latest version and using the "Exact Version" option. Once complete, click "Add Package".
  4. From the Choose Package Products window, verify GoogleRidesharingConsumer will be added to your designated main target. Once complete, click "Add Package".
  5. To verify your installation, navigate to your target's General pane. In the Frameworks, Libraries, and Embedded Content you should see the installed packages. You can also view the "Package Dependencies" section of "Project Navigator" to verify the package and its version.

To update the package for an existing project, follow these steps:

  1. If you are upgrading from a version earlier than 9.0.0, you must remove the following dependencies: GoogleMapsBase, GoogleMapsCore, and GoogleMapsM4B after upgrading. Do not remove the dependency for GoogleMaps. For more information, see the Version 9.0.0 Release Notes.

    From your Xcode project configuration settings, find Frameworks, Libraries, and Embedded Content. Use the minus sign(-) to remove the following framework:

    • GoogleMapsBase (Only for upgrades from versions earlier than 9.0.0)
    • GoogleMapsCore (Only for upgrades from versions earlier than 9.0.0)
    • GoogleMapsM4B (Only for upgrades from versions earlier than 9.0.0)
  2. From Xcode, go to "File > Packages > Update To Latest Package Versions".
  3. To verify your installation, go to the Package Dependencies section of Project Navigator to verify the package and its version.

To remove existing Consumer SDK dependencies added using CocoaPods, follow these steps:

  1. Close your Xcode workspace. Open terminal and execute the following command:
    sudo gem install cocoapods-deintegrate cocoapods-clean 
    pod deintegrate 
    pod cache clean --all
  2. Remove the Podfile, Podfile.resolved and the Xcode workspace if you are not using them for anything other than CocoaPods.

To remove the existing Consumer SDK installed manually, follow these steps:

  1. From your Xcode project configuration settings, find Frameworks, Libraries, and Embedded Content. Use the minus sign(-) to remove the following framework:

    • GoogleRidesharingConsumer.xcframework
  2. From the top level directory of your Xcode project, remove the GoogleRidesharingConsumer bundle.

Use CocoaPods

  1. Install the CocoaPods tool: Open a terminal window and run the following command:

    sudo gem install cocoapods
    

    For more details, refer to the CocoaPods Get Started guide.

  2. Create a Podfile for the Consumer SDK: You use the Podfile to install the API and its dependencies.

    1. Create a file named Podfile in your project directory. This file defines your project's dependencies.

    2. Edit the Podfile and add your dependencies. Here is an example which includes the dependencies:

      source "https://github.com/CocoaPods/Specs.git"
      target 'YOUR_APPLICATION_TARGET_NAME_HERE' do
        pod 'GoogleRidesharingConsumer'
      end
      
    3. Save the Podfile: Open a terminal and go to the folder with the Podfile:

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

    pod install
    
  4. Open your project in Xcode: Close Xcode and then open (double-click) your project's .xcworkspace file to launch Xcode. To open the project later, use the .xcworkspace file.

Manual installation

This guide shows how to manually add the XCFramework containing the Consumer SDK to your project and configure your build settings in Xcode.

Before following this guide, do the following:

  • Download the XCFramework, a binary package that you use to install the Consumer SDK. You can use this package on multiple platforms, including machines using the M1 chipset.

  • Install the Maps SDK.

  1. Download the SDK binary and resources:

  2. Unpack the zipped files to access the XCFramework and resources.

  3. Start Xcode and either open or create a project. If you're new to iOS, create a new project and select the iOS App template.

  4. If your project group does not contain a Frameworks group, create it.

  5. Drag the downloaded gRPCCertificates.bundle file into the top-level directory of your Xcode project. If prompted, select Copy items.

  6. To install the Consumer SDK, drag the GoogleRidesharingConsumer.xcframework file into your project under Frameworks, Libraries, and Embedded Content. If prompted, select Copy items.

  7. Drag the downloaded GoogleRidesharingConsumer.bundle into the top-level directory of your Xcode project. If prompted, select Copy items.

  8. Select your project from the Project Navigator, and choose your application's target.

  9. Open the Build Phases tab, and in Link Binary with Libraries, add the following frameworks and libraries if they are not already present:

    • Accelerate.framework
    • CoreData.framework
    • CoreGraphics.framework
    • CoreImage.framework
    • CoreLocation.framework
    • CoreTelephony.framework
    • CoreText.framework
    • GLKit.framework
    • ImageIO.framework
    • libc++.tbd
    • libz.tbd
    • Metal.framework
    • OpenGLES.framework
    • QuartzCore.framework
    • SystemConfiguration.framework
    • UIKit.framework
  10. Choose your project, rather than a specific target, and open the Build Settings tab. In the Other Linker Flags section, add -ObjC for both debug and release.

    If these settings are not visible, change the filter in the Build Settings bar from Basic to All.

Inspect Apple Privacy Manifest file

Apple requires app privacy details for apps on the App Store. Visit the Apple App Store Privacy Details page for updates and more information.

The Apple Privacy Manifest file is included in the resources bundle for the SDK. To verify that the Privacy Manifest File has been included, and to inspect its contents, create an archive of your app and generate a privacy report from the archive.

What's next

Configure a Google Cloud Console project