IOS SDK

From Social ID Developers
Revision as of 18:23, 17 October 2014 by Dirceu.tiegs (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

Download and Setup the SDK

You can download and setup the SDK using our iOS SDK Setup guide.

Social Login

Add the following statement to your ViewController:

 #import <SocialID/SocialID.h>

Call the following code to make the user log in with Facebook:

 [SIDFacebook logInWithPermissions:@[@"public_profile",@"email",@"user_birthday"] success:^(SIDSignIn *signIn) {
     NSLog(@"Logged in Facebook!");
 } failure:^(NSError *error) {
     // do something
 }];

Call the following code to make the user log in with Google+:

 [SIDGoogle logInGoogle:^(NSString *accessToken) {
     NSLog(@"Logged in Google!");
 } failure:^(NSError *error) {
     // do something
 }];

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
 [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];
 }

Logout

COMING SOON...

Get the user profile

COMING SOON...

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox