在系统偏好设置中配置了Facebook帐户后,Facebook登录错误 [英] Facebook Login error when facebook account is already configured in system preferences

查看:147
本文介绍了在系统偏好设置中配置了Facebook帐户后,Facebook登录错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在facebook SDK中遇到了一个问题.

I have faced an issue in facebook SDK.

如果我从系统偏好设置/Facebook 中删除了Facebook帐户,然后尝试登录Facebook,那么它将重定向我到Facebook本机应用程序的safari中,并且我可以登录.

if I remove facebook account from System Preferences/Facebook and after that I try to login with facebook then it will redirect me to safari of facebook native application and I can logged in.

但是,当我在系统偏好设置/Facebook 中添加Facebook帐户,然后尝试登录Facebook时,它将无法重定向我并弹出您的应用"想要访问您的基本信息和朋友列表.,我允许.但是FBSessionStatus总是失败,并且我无法登录.

But when I add facebook account in System Preferences/Facebook and after that I try to login with facebook then it will not redirect me and give popup "Your app" would like to access your basic info and list of friends. and I allows to it. but FBSessionStatus always failed and I cannot logged in.

我已经尝试了很多搜索,但没有找到解决方法.

I have try to search much but not get solution for it.

我已经使用了最新的facebookSDK.

I have use latest facebookSDK.

我的登录代码如下

    NSArray *permissions = [[NSArray alloc] initWithObjects:@"email",nil];

    // Attempt to open the session. If the session is not open, show the user the Facebook login UX

    [FBSession openActiveSessionWithReadPermissions:permissions
                                       allowLoginUI:true
                                  completionHandler:^(FBSession *session,
                                                      FBSessionState status,
                                                      NSError *error)
     {
         NSLog(@"Running completion handler");

         if (status == FBSessionStateClosedLoginFailed || status == FBSessionStateCreatedOpening) {
             NSLog(@"Unable to activate Facebook Session");
         }
         else {
             NSLog(@"Logged in via facebook.  Requesting User Information.");
         }
     }];

并在AppDelegate.h

and in AppDelegate.h

@property (strong, nonatomic) FBSession *fbsession;

AppDelegate.m

AppDelegate.m

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
    return [FBSession.activeSession handleOpenURL:url];
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    NSLog(@"AppDelegate is attempting to extract Facebook token from URL");
    return [FBAppCall handleOpenURL:url sourceApplication:sourceApplication withSession:self.fbsession];
}

我每次都会得到如下日志

I get log every Time as below

AppDelegate is attempting to extract Facebook token from URL
Unable to activate Facebook Session

请帮助我解决此问题. 预先感谢.

Please help me to solve this issue. Thanks in advance.

推荐答案

我通过在developer.facebook.com上的facebook应用中添加捆绑标识符来找到我的解决方案(制作iOS本机应用)

I found my Solution by adding bundle identifier in facebook app on developer.facebook.com (make iOS native app)

这篇关于在系统偏好设置中配置了Facebook帐户后,Facebook登录错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆