Google distributes several iOS specific APIs and SDKs via CocoaPods. CocoaPods is an open source dependency manager for Swift and Objective-C Cocoa projects. CocoaPods makes it easy to install or update new SDKs when working with Xcode.
You can install the CocoaPods tool on OS X by running the following command from the terminal. Detailed information is available in the Getting Started guide.
$ sudo gem install cocoapods
Add a Google SDK to your iOS app
CocoaPods is used to install and manage dependencies in existing Xcode projects.
- Create an Xcode project, and save it to your local machine.
- Create a file named
Podfile
in your project directory. This file defines your project's dependencies, and is commonly referred to as a Podspec. Open
Podfile
, and add your dependencies. A simple Podspec is shown here:platform :ios, '8.1' target "YourProjectNameHere" do pod 'Firebase' end
Save the file.
Open a terminal and
cd
to the directory containing the Podfile.$ cd <path-to-project>/project/
Run the
pod install
command. This will install the SDKs specified in the Podspec, along with any dependencies they may have.$ pod update
Open your app's
.xcworkspace
file to launch Xcode. Use this file for all development on your app.
CocoaPods published by Google
Below is a complete list of the Podspecs published by Google.
CocoaPods published by Google | |
---|---|
App Invites | AppInvites |
Google Analytics | GoogleAnalytics |
Google App Indexing | GoogleAppIndexing |
Google Cloud Messaging | GoogleCloudMessaging |
Google Conversion Tracking | GoogleConversionTracking |
Google Maps | GoogleMaps |
Google Mobile Ads | GoogleMobileAds |
Google IDFA Support | GoogleIDFASupport |
Google Places | GooglePlaces |
Google Sign In | GoogleSignIn |
Google Tag Manager | GoogleTagManager |
Instance ID | GGLInstanceID |
Google Cast | google-cast-sdk |
Firebase | Firebase |
Google Play Games Services | GooglePlayGames |
GeoFire | GeoFire |
Google Interactive Media Ads | GoogleAds-IMA-iOS-SDK |
Nearby Messages | NearbyMessages |
FAQ
- I'm using CocoaPods. How do I update to the latest version of the SDK?
- In the terminal, run
pod update
in the directory where thePodfile
is located. - What can I do if the
pod
command isn't working? - CocoaPods may not be installed on your system. Please follow the Getting Started guide and try again. If that doesn't resolve the issue, check the status of the CocoaPods service at: https://status.cocoapods.org/.