IOS SDK Setup
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.
Setup FacebookSDK (if you didn't already)
Follow the instructions here.
Setup GoogleSDK (if you didn't already)
Follow the instructions here. It's 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:
- applicationId: Set up a Social-Id LoginApp at: https://app.socialidnow.com/marketing/login/apps. Your key is the id of the app.
- applicationSecret: The secret can be found on the Call the API menu - https://app.socialidnow.com/marketing/login/apps/APP_ID/apis.
- marketingAccountId: This can be found at: https://app.socialidnow.com/marketing/apis.
- marketingAccountSecret: This can be found at: https://app.socialidnow.com/marketing/apis.
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
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's 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:
- applicationId: Set up an SocialId LoginApp at: https://app.socialidnow.com/marketing/login/apps. Your key is the id of the app.
- applicationSecret: The secret can be found at the Call the API menu - https://app.socialidnow.com/marketing/login/apps/APP_ID/apis.
- marketingAccountId: This can be found at: https://app.socialidnow.com/marketing/apis.
- marketingAccountSecret: This can be found at: https://app.socialidnow.com/marketing/apis.
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)