IOS SDK
(Difference between revisions)
Dirceu.tiegs (Talk | contribs) |
Dirceu.tiegs (Talk | contribs) |
||
Line 17: | Line 17: | ||
}]; | }]; | ||
− | + | Call the following code to make the user log in with Google+: | |
[SIDGoogle logInGoogle:^(NSString *accessToken) { | [SIDGoogle logInGoogle:^(NSString *accessToken) { | ||
NSLog(@"Logged in Google!"); | NSLog(@"Logged in Google!"); | ||
+ | } failure:^(NSError *error) { | ||
+ | // do something | ||
+ | }]; | ||
+ | |||
+ | Call the following code to make the user log in with LinkedIn: | ||
+ | |||
+ | [SIDLinkedin initializeLinkedin]; | ||
+ | [[SIDLinkedin getInstance] setWebView:webView]; // this webview should be created and initialized separately | ||
+ | [SIDLinkedin logInLinkedin:^(NSString *accessToken) { | ||
+ | NSLog(@"Logged in LinkedIn!"); | ||
} failure:^(NSError *error) { | } failure:^(NSError *error) { | ||
// do something | // do something | ||
Line 27: | Line 37: | ||
= Logout = | = Logout = | ||
− | + | [[SocialID getInstance] logout]; | |
= Get the user profile = | = Get the user profile = | ||
− | + | To get the user profile, use the following code: | |
+ | |||
+ | [[SocialID getInstance] getUser:"display_name,verified_email,current_location" success:^(SIDUser *user) { | ||
+ | SIDUserProfile *profile = user.profile; | ||
+ | } failure:^(NSError *error) { | ||
+ | NSLog(@"Error: %@", error); | ||
+ | }]; | ||
+ | |||
+ | The complete list of fields can be found on [[Social_Profile_Fields]]. |
Revision as of 18:41, 29 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 }];
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 }];
Call the following code to make the user log in with LinkedIn:
[SIDLinkedin initializeLinkedin]; [[SIDLinkedin getInstance] setWebView:webView]; // this webview should be created and initialized separately [SIDLinkedin logInLinkedin:^(NSString *accessToken) { NSLog(@"Logged in LinkedIn!"); } failure:^(NSError *error) { // do something }];
Logout
[[SocialID getInstance] logout];
Get the user profile
To get the user profile, use the following code:
[[SocialID getInstance] getUser:"display_name,verified_email,current_location" success:^(SIDUser *user) { SIDUserProfile *profile = user.profile; } failure:^(NSError *error) { NSLog(@"Error: %@", error); }];
The complete list of fields can be found on Social_Profile_Fields.