[objc]iOSフェイスブックにログイン(Feat.PhotoUrlを取得)


Firebasesdkを使用せずにiOSでFacebookログインを実現
チュートリアル:
@import FBSDKCoreKit;
@import FBSDKLoginKit;

- (void)facebookAuth:(UIViewController*)uiview
{    
    FBSDKLoginManager *loginManager = [[FBSDKLoginManager alloc] init];
    [loginManager logInWithPermissions:@[ @"public_profile", @"email" ]
                    fromViewController:uiview
                               handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)
    {
        if (error) {
            NSLog(@"%@", error.localizedDescription);
        } else if (result.isCancelled){
            NSLog(@"FBLogin cancelled");
        }else{
            if ([FBSDKAccessToken currentAccessToken])
            {
                [[[FBSDKGraphRequest alloc] initWithGraphPath:@"me"
                                                   parameters:@{@"fields": @"id, name, picture.type(normal), email"}]
                 startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error)
                 {
                    if (!error) {
                    	NSLog(@"%@", result);
                    }
                }];
            }
        }
    }];
}
スタックオーバーフロー
https://stackoverflow.com/questions/29323244/facebook-ios-sdk-4-0how-to-get-user-email-address-from-fbsdkprofile
フェイスブック
https://developers.facebook.com/docs/ios/graph?locale=ko_KR