IOS SDK Setup

(Difference between revisions)
Jump to: navigation, search
(Get your SocialID data)
Line 73: Line 73:
 
* clientSecret: The client secret for your "Client ID for iOS application" (found in APIs & auth -> Credentials)
 
* 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)
 
* serverID: The client ID for a "Client ID for web application" entry (found in APIs & auth -> Credentials)
 +
 +
And you will need to add three more items to make LinkedIn login work:
 +
 +
* LinkedinCallbackUrl: the callback url you set up on the LinkedIn oauth1 app
 +
* LinkedinAPIKey: the API / consumer key you set up on the LinkedIn oauth1 app
 +
* LinkedinAPISecret: the API / consumer secret you set up on the LinkedIn oauth1 app
  
 
= New Project =
 
= New Project =
Line 105: Line 111:
 
Fill in the variables in the following code found in SocialIDSampleAppDelegate.m:
 
Fill in the variables in the following code found in SocialIDSampleAppDelegate.m:
  
   [SocialID setApplicationId:36 secret:@"2a4db383424afe4b712d5dddc2b2fd936d66101673b746344c8c601409a49b0c"];
+
   [SocialID setApplicationId:XXX secret:@"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"];
   [SocialID setMarketingAccountId:142 secret:@"d6be2356a0531168083403e985980bd280dd3c368b8c2c949152abe94ae450e2"];
+
   [SocialID setMarketingAccountId:XXX secret:@"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"];
  
 
== Modify Info.plist ==
 
== Modify Info.plist ==
Line 120: Line 126:
 
* clientSecret: The client secret for your "Client ID for iOS application" (found in APIs & auth -> Credentials)
 
* 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)
 
* serverID: The client ID for a "Client ID for web application" entry (found in APIs & auth -> Credentials)
 +
 +
And you will need to add three more items to make LinkedIn login work:
 +
 +
* LinkedinCallbackUrl: the callback url you set up on the LinkedIn oauth1 app
 +
* LinkedinAPIKey: the API / consumer key you set up on the LinkedIn oauth1 app
 +
* LinkedinAPISecret: the API / consumer secret you set up on the LinkedIn oauth1 app

Revision as of 19:45, 28 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)

And you will need to add three more items to make LinkedIn login work:

  • LinkedinCallbackUrl: the callback url you set up on the LinkedIn oauth1 app
  • LinkedinAPIKey: the API / consumer key you set up on the LinkedIn oauth1 app
  • LinkedinAPISecret: the API / consumer secret you set up on the LinkedIn oauth1 app

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 Social-ID 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:XXX secret:@"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"];
 [SocialID setMarketingAccountId:XXX secret:@"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"];

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)

And you will need to add three more items to make LinkedIn login work:

  • LinkedinCallbackUrl: the callback url you set up on the LinkedIn oauth1 app
  • LinkedinAPIKey: the API / consumer key you set up on the LinkedIn oauth1 app
  • LinkedinAPISecret: the API / consumer secret you set up on the LinkedIn oauth1 app
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox