IOS SDK

(Difference between revisions)
Jump to: navigation, search
(Created page with "= 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: ...")
 
Line 5: Line 5:
 
= Social Login =
 
= Social Login =
  
Add the following statement to your ViewController:
+
After setting up the SDK ([[iOS SDK Setup]]), add the following statement to your ViewController:
  
 
   #import <SocialID/SocialID.h>
 
   #import <SocialID/SocialID.h>
Line 17: Line 17:
 
   }];
 
   }];
  
Call the following code to make the user log in with Google+:
+
... and call the following code to make the user log in with Google+:
  
 
   [SIDGoogle logInGoogle:^(NSString *accessToken) {
 
   [SIDGoogle logInGoogle:^(NSString *accessToken) {
Line 24: Line 24:
 
       // do something
 
       // 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 =
 
= Logout =

Revision as of 18:50, 17 October 2014

Contents

Download and Setup the SDK

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

Social Login

After setting up the SDK (iOS SDK Setup), 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
 }];

... and 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
 }];

Logout

COMING SOON...

Get the user profile

COMING SOON...

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox