To follow on-demand trips in your iOS consumer apps, use the Consumer SDK. For more information on and an introduction to following trips, see Follow a trip in iOS.
To set up the Consumer SDK for your iOS consumer app, follow these steps:
- Check the minimum system requirements.
- Get the Consumer SDK.
- Inspect Apple Privacy Manifest file.
- Configure a Google Cloud Console project.
- Get authentication tokens.
- 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:
-
Open your Xcode
project
orworkspace
, then go to File > Add Package Dependencies. - Enter https://github.com/googlemaps/ios-consumer-sdk as the URL, press Enter to pull in the package, and click "Add Package".
-
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". -
From the Choose Package Products window, verify
GoogleRidesharingConsumer
will be added to your designatedmain
target. Once complete, click "Add Package". -
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:
- From Xcode, go to "File > Packages > Update To Latest Package Versions".
- To verify your installation, go to the Package Dependencies section of Project Navigator to verify the package and its version.
To remove the existing Consumer SDK installed manually, follow these steps:
From your Xcode project configuration settings, find Frameworks, Libraries, and Embedded Content. Use the minus sign
(-)
to remove the following framework:GoogleRidesharingConsumer.xcframework
From the top level directory of your Xcode project, remove the
GoogleRidesharingConsumer
bundle.
Use CocoaPods
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.
Create a Podfile for the Consumer SDK: You use the Podfile to install the API and its dependencies.
Create a file named
Podfile
in your project directory. This file defines your project's dependencies.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
Save the Podfile: Open a terminal and go to the folder with the Podfile:
cd <path-to-project>
Run the pod install command: This command installs the APIs specified in the Podfile, along with any dependencies they may have.
pod install
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.
Download the SDK binary and resources:
Unpack the zipped files to access the XCFramework and resources.
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.
If your project group does not contain a Frameworks group, create it.
Drag the downloaded
gRPCCertificates.bundle
file into the top-level directory of your Xcode project. If prompted, select Copy items.To install the Consumer SDK, drag the
GoogleRidesharingConsumer.xcframework
file into your project under Frameworks, Libraries, and Embedded Content. If prompted, select Copy items.Drag the downloaded
GoogleRidesharingConsumer.bundle
into the top-level directory of your Xcode project. If prompted, select Copy items.Select your project from the Project Navigator, and choose your application's target.
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
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.