IOS SDK Setup

(Difference between revisions)
Jump to: navigation, search
(Setup GoogleSDK (if you didn't already))
(Setup GoogleSDK (if you didn't already))
Line 13: Line 13:
 
== Setup GoogleSDK (if you didn't already) ==
 
== Setup GoogleSDK (if you didn't already) ==
  
Follow the instructions [https://developers.google.com/+/mobile/ios/getting-started here]. It's important to follow the instructions to the letter (set up all required frameworks, set -ObjC under "Other Linker Flags", etc.).
+
Follow the instructions [https://developers.google.com/+/mobile/ios/getting-started here]. It is important to follow the instructions to the letter (set up all required frameworks, set -ObjC under "Other Linker Flags", etc.).
  
 
== Get your Social-ID data ==
 
== Get your Social-ID data ==

Revision as of 16:45, 6 November 2014

Contents

Existing Project

Download the SDK

Extract the zip file's contents and drag & drop the SocialID.framework file to the "Frameworks" folder in your XCode project.

Download the SDK

Setup FacebookSDK (if you didn't already)

Follow the instructions here.

Setup GoogleSDK (if you didn't already)

Follow the instructions here. It is important to follow the instructions to the letter (set up all required frameworks, set -ObjC under "Other Linker Flags", etc.).

Get your Social-ID data

You will need 4 variables to configure the SDK:

Add the SDK to your app

Add the following statement to your ViewController:

 #import <SocialID/SocialID.h>

Add the following code to your app delegate header file:

 #import <GooglePlus/GooglePlus.h>

... and make it implement the <GPPSignInDelegate> protocol. For example:

 @interface SocialIDSampleAppDelegate : UIResponder <UIApplicationDelegate, GPPSignInDelegate>

Add the following code to the (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method in your app delegate implementation file:

 // Initialize SocialID SDK (use the data you collected in the "Get your SocialID data" step)
 [SocialID setApplicationId:XXX secret:@"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"];
 [SocialID setMarketingAccountId:XXX secret:@"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"];
 [SIDFacebook initializeFacebook];
 [SIDGoogle initializeGoogle];
 [SIDGoogle setDelegate:self];

Add the following methods to your app delegate implementation file:

 - (void) finishedWithAuth: (GTMOAuth2Authentication *)auth
                     error: (NSError *) error {
     [SIDGoogle finishedWithAuth:auth error:error];
 }
 - (BOOL) application: (UIApplication *)application
              openURL: (NSURL *)url
    sourceApplication: (NSString *)sourceApplication
           annotation: (id)annotation {
     return [SIDGoogle application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
 }

Modify Info.plist

If you followed the first steps correctly, you should already have the following data in your app Info.plist file:

  • FacebookAppID
  • FacebookDisplayName
  • clientID

You will need to add two more items to make Google+ login work:

  • clientSecret: The client secret for your "Client ID for iOS application" (found in APIs & auth -> Credentials)
  • serverID: The client ID for a "Client ID for web application" entry (found in APIs & auth -> Credentials)

New Project

Download & unzip the sample project

Download the project

Open the project in XCode

Unzip the file, open XCode and use File -> Open to find and open the project's folder.

Setup FacebookSDK (if you didn't already)

Follow the instructions here.

Setup GoogleSDK (if you didn't already)

Follow the instructions here. It is important to follow the instructions to the letter (set up all required frameworks, set -ObjC under "Other Linker Flags", etc.).

Get your SocialID data

You'll need 4 variables to configure the SDK:

Initialize the SDK

Fill in the variables in the following code found in SocialIDSampleAppDelegate.m:

 [SocialID setApplicationId:36 secret:@"2a4db383424afe4b712d5dddc2b2fd936d66101673b746344c8c601409a49b0c"];
 [SocialID setMarketingAccountId:142 secret:@"d6be2356a0531168083403e985980bd280dd3c368b8c2c949152abe94ae450e2"];

Modify Info.plist

If you followed the first steps correctly, you should already have the following data in your app Info.plist file:

  • FacebookAppID
  • FacebookDisplayName
  • clientID

You will need to add two more items to make Google+ login work:

  • clientSecret: The client secret for your "Client ID for iOS application" (found in APIs & auth -> Credentials)
  • serverID: The client ID for a "Client ID for web application" entry (found in APIs & auth -> Credentials)
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox