Before you can begin integrating your iOS app with the Google+ components, you must create a Google Developers Console project, download the SDK, and configure your Xcode project. The steps on this page do just that. The next steps then describe how to integrate Google+ features into your app.
You can try out the quick-start sample app if you would like to quickly experiment with features of the platform.
Before you begin
- Download the latest Google+ iOS SDK, which requires iOS 6 or higher.
- (Optional) Try the quick-start sample project,
which is in the
SampleCodedirectory in the SDK.
- Install Xcode 4.5 or later
Step 1. Creating the Google Developers Console projectTo enable the Google+ API for your app, you need to create a Google Developers Console project, enable the Google+ API then create a client ID.
- Go to the Google Developers Console.
- Select a project, or create a new one.
- In the sidebar on the left, select APIs & auth (the APIs sub-element is automatically selected).
- In the displayed list of APIs, make sure the Google+ API status is set to ON, as well as any other APIs that your app requires. If you plan to use other APIs, turn those on as well.
- In the sidebar on the left, select Credentials.
In the OAuth section of the page, select Create New Client ID.
In the resulting Create Client ID dialog box, do the following:
- Select Installed application for the Application type.
- Select iOS.
- In the Bundle ID field, enter the bundle identifier from your application's project summary.
- If your app is published in the Apple iTunes App Store, enter your app's App Store identifier in the App Store ID field. You can determine the ID from the "id" part of your app's URL on the iTunes website: http://itunes.apple.com/us/app/id<YOUR_APP_STORE_ID>.
- (Optional) If you plan to build deep linking into shared posts made from your app, enable Deep Linking.
- Click the Create client ID button.
- In the resulting Client ID for iOS application panel, note or copy the Client ID that your app will need to run the sample.
Step 2. Initialize the Google+ Client
Initializing the client sets up your project with the minimal settings. Depending on your app's needs, you will further configure your project to handle signing in with Google+, sharing, and writing app activities to Google.
Download the Google+ iOS SDK, if you haven't already. The SDK includes:
GooglePlus.bundleresource bundle with assets for the Google+ Sign-In button.
GoogleOpenSource.frameworkwhich is a static framework that contains all of the files within the
- The sample Xcode project.
Extract the files from the downloaded SDK archive.
Include the following frameworks in your Xcode project:
Drag and drop the following frameworks from the SDK into your XCode project:
If your project already includes some of the open source files, you can instead include the remaining files from the OpenSource folder.
If you plan to use the sign-in button provided by the SDK, include the
GooglePlus.bundlein your XCode project to add it to your target.
Add the ObjC linker flag to the app target's build settings:
Other Linker Flags: -ObjC
In your app's controller, set your client ID:
static NSString * const kClientId = @"YOUR_CLIENT_ID";
Step 3. Add a URL type
In your app's Info tab, add a URL type and enter your bundle ID as the identifier and scheme:
Now that you created your Google Developers Console project and configured your xcode project, you can add your choice of Google+ features to your app:
Frequently asked questions
- I'm getting the error ARC forbids explicit message send of 'autorelease'.
You need to disable "Automatic Reference Counting" for select files in the Google+ iOS SDK. Navigate to your project's settings, click Targets > Build Phases > and add the
-fno-objc-arccompiler flag for every open source dependency provided by the Google+ iOS SDK.