IOS SDK Setup

From Social ID Developers
Revision as of 14:45, 17 September 2015 by Renato.neves (Talk | contribs)
Jump to: navigation, search

Contents

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

SDK dependencies:

  • FacebookSDK.framework (version 3.24.0)
  • GooglePlus.framework (version 1.7.1)
  • GoogleOpenSource.framework (version 1.7.1)
  • SystemConfiguration.framework
  • UIKit.framework
  • Foundation.framework

The Facebook and Google SDKs also have its own dependencies. Follow the next instructions to setup them.

Setup Facebook iOS SDK

Follow the instructions here if you didn't already.

You need to follow the steps 4 and 5:

The other steps are optional. You can follow them if you want to explore more features from Facebook SDK.

Setup Google iOS SDK

Follow the instructions here if you didn't already.

You need to follow all steps:

Get your SocialID Data

You will need 2 variables to configure the SDK:

Setup the Social-ID SDK into your app

Add the following statement to your ViewController:

 #import <SocialID/SocialID.h>

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 clientSecret:@"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"];

In the same App Delegate method, setup the Social Login with the user profile fields you want to be retrieved and the Facebook permissions you want to ask to the user. Example initializing the Facebook, Google+ and LinkedIn logins:

 // Initialize the Social Login
 [SIDLogin setUserFields:@"display_name,picture_url,current_location,verified_email"];
 [SIDFacebook initializeFacebook];
 [SIDFacebook setPermissions:@[@"public_profile",@"email",@"user_birthday"]];
 [SIDGoogle initializeGoogle];
 [SIDLinkedin initializeLinkedin];

Add the following method to your app delegate implementation file:

 - (BOOL) application: (UIApplication *)application
              openURL: (NSURL *)url
    sourceApplication: (NSString *)sourceApplication
           annotation: (id)annotation {
     return [SIDLogin handleOpenURL:url sourceApplication:sourceApplication annotation:annotation];
 }

Modify Info.plist

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

  • FacebookAppID
  • FacebookDisplayName
  • fb{FACEBOOK_APP_ID} in the URL types

You should also already have your bundle ID as an URL type, that is required by Google+ SDK. You will need to add one more item to make Google+ login work:

  • GoogleClientID: The Client ID for your "Client ID for iOS application" (found in APIs & auth -> Credentials)

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

  • 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