Google+ Platform for iOS

Getting Started with the Google+ Platform for iOS

Before you can begin integrating your iOS app with the Google+ components, you must create an API Console project, download the SDK, and configure your Xcode project.

Download the Google+ iOS SDK

Before you begin

Step 1. Creating the APIs Console project

To enable the Google+ API for your app, you need to create an APIs Console project, enable the Google+ API then create and get a client ID.
  1. In the Google APIs Console , select Create from the pull-down menu on the left, enter a project name (such as "iOS App"), and click the Create project button.
  2. In the Services pane, enable the Google+ API and any other APIs that your app requires by turning them on. If you plan to use other APIs, turn those on as well.
  3. In the API Access pane, click Create an OAuth 2.0 Client ID.
    1. In the Product name field, enter a name for your application (such as "Sample"), and click Next. Providing a product logo is optional.
    2. In the Create Client ID dialog box, shown below, 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 iTunes website:<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.
      • Shows options in the Create Client ID dialog box.

  4. In the API Access pane, locate the section Client ID for installed applications and note or copy the Client ID that you will need later 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.

  1. Download the Google+ iOS SDK, if you haven't already. The SDK includes:

    • GooglePlus.framework
    • GooglePlus.bundle resource bundle with assets for the Google+ Sign-In button.
    • GoogleOpenSource.framework which is a static framework that contains all of the files within the OpenSource directory.
    • The sample Xcode project.
  2. Extract the files from the downloaded SDK archive.

  3. Include the following frameworks in your Xcode project:

    • AddressBook.framework
    • AssetsLibrary.framework
    • Foundation.framework
    • CoreLocation.framework
    • CoreMotion.framework
    • CoreGraphics.framework
    • CoreText.framework
    • MediaPlayer.framework
    • Security.framework
    • SystemConfiguration.framework
    • UIKit.framework
  4. Drag and drop the following frameworks from the SDK into your XCode project:

    • GooglePlus.framework
    • GoogleOpenSource.framework

    If your project already includes some of the open source files, you can instead include the remaining files from the OpenSource folder.

  5. If you plan to use the sign-in button provided by the SDK, include the GooglePlus.bundle in your XCode project to add it to your target.

  6. Add the ObjC linker flag to the app target's build settingss:

    Other Linker Flags: -ObjC
  7. 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:

Graphic that shows the identifier and URL Schemas fields with the value of com.example.bundle entered.

Next steps

Now that you created your APIs 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-arc compiler flag for every open source dependency provided by the Google+ iOS SDK.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.