2016-08-09 5 views

答えて

2

カスタムUIButtonを作成し、次のメソッドに接続するだけです。

は、ここではFacebookのログイン用のカスタムボタンについて詳しく読む:それは働いたhttps://developers.facebook.com/docs/facebook-login/ios#custom-login-button

#import <FBSDKLoginKit/FBSDKLoginKit.h> 

- (IBAction)facebookLoginPressed:(id)sender{ 
     FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init]; 
     [login 
     logInWithReadPermissions: @[@"public_profile"] 
     fromViewController:self 
     handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) { 
      if (error) { 
       NSLog(@"Process error"); 
      } else if (result.isCancelled) { 
       NSLog(@"Cancelled"); 
      } else { 
       NSLog(@"Logged in"); 
       FIRAuthCredential *credential = [FIRFacebookAuthProvider credentialWithAccessToken:[FBSDKAccessToken currentAccessToken].tokenString]; 
      } 
     }]; 
} 
+0

、感謝を! – abcd123