Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios Facebook登录-如果存在用户帐户(且未安装应用程序),则登录失败_Ios_Facebook_Facebook Login_Facebook Sdk 3.1 - Fatal编程技术网

Ios Facebook登录-如果存在用户帐户(且未安装应用程序),则登录失败

Ios Facebook登录-如果存在用户帐户(且未安装应用程序),则登录失败,ios,facebook,facebook-login,facebook-sdk-3.1,Ios,Facebook,Facebook Login,Facebook Sdk 3.1,我刚刚在测试我的应用程序时发现了这个问题,它真的开始困扰我了。所以环境是这样的: 没有安装Facebook应用程序 用户已登录iOS系统帐户(在设置->Facebook下) 当我的应用程序第一次尝试对用户进行身份验证时,它提供了这堵文本墙:(我试着清理一下) 我尝试过改变我的身份验证方式,但总是遇到同样的问题。。。有什么想法吗 谢谢 A我想我在这里重现了您的错误,您的应用程序在设置中被拒绝访问Facebook帐户(出于某种原因,可能您单击了“不允许”…) 在用户拒绝访问或在Facebook设

我刚刚在测试我的应用程序时发现了这个问题,它真的开始困扰我了。所以环境是这样的:

  • 没有安装Facebook应用程序
  • 用户已登录iOS系统帐户(在设置->Facebook下)
当我的应用程序第一次尝试对用户进行身份验证时,它提供了这堵文本墙:(我试着清理一下)

我尝试过改变我的身份验证方式,但总是遇到同样的问题。。。有什么想法吗

谢谢


A

我想我在这里重现了您的错误,您的应用程序在设置中被拒绝访问Facebook帐户(出于某种原因,可能您单击了“不允许”…) 在用户拒绝访问或在Facebook设置中关闭开关后,应用程序将不会再次请求权限,每次您尝试连接时,它都将失败,并显示FBErrorCategoryUserCancelled状态

要解决此问题,请转到设置>常规>重置,然后重置位置和隐私。
运行应用程序之后,您应该能够看到请求权限的提示。

我也遇到了同样的问题,这让我发疯。通过将Facebook SDK更新为最新版本,我得到了修复


不确定这是否是你的问题,但我希望这有助于某人

转到Facebook开发者>你的应用程序>设置>基础

单击添加平台

输入您的捆绑ID

打开单点登录


保存更改。

您是否在权限数组中指定了
basic\u info
权限?当然!如果FB应用程序存在,它可以工作(验证),因此我相信权限是正确的。你可以在facebook下签入设置吗?如果你的应用程序权限为off,那么off是什么意思?当我在FB上转到我的设置时,我会在那里看到应用程序。。。。我在找什么?右边一定有一个UI开关。它关闭了吗?没有工作-我应该从我的FB设置中删除应用程序,然后重置我的设备(simluator)吗?如果这种情况发生在“真实”环境中,当你休息的位置和隐私,你的应用程序不应该在FB设置Sokay现在我从我的FB删除了应用程序,我重置你说-。它现在让我登录,并在成功登录后引用相同的错误立即让我注销,但现在它还显示错误400,用户未对应用程序进行身份验证(这是有意义的,因为我从未有过验证的机会),它还显示会话不再有效…当您尝试登录时,应用程序会显示一条提示,要求获得访问FB帐户的权限?不,不会,只要我登录到系统帐户,它就会立即失败。当我按照你说的做的时候,我犯了一些象征性的错误,然后又犯了其他的错误……说真的,这对他们来说怎么会是一个可以接受的做法呢?
2014-01-30 15:20:31.439 Unifeed[2140:70b] Session is <FBSession: 0xb74f9e0, state:         
FBSessionStateClosedLoginFailed, 
loginHandler: 0x0, appID: *************, urlSchemeSuffix: ,    
 tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0xb73bd90>,
 expirationDate: (null),     
refreshDate: (null), attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(null)>

2014-01-30 15:20:31.440 Unifeed[2140:70b] Session closed
2014-01-30 15:20:31.440 Unifeed[2140:70b] User logged out

2014-01-30 15:20:31.441 Unifeed[2140:70b] Error occured Error Domain=com.facebook.sdk Code=2    
"The operation couldn’t be completed. (com.facebook.sdk error 2.)"
UserInfo=********  
{com.facebook.sdk:ErrorLoginFailedReason=com.facebook.sdk:SystemLoginCancelled,    
com.facebook.sdk:ErrorInnerErrorKey=Error Domain=com.apple.accounts Code=7 "The operation 
couldn’t be completed. (com.apple.accounts error 7.)", 
com.facebook.sdk:ErrorSessionKey=<FBSession: 0xb74f9e0, state: FBSessionStateClosedLoginFailed,   
loginHandler: 0x0, appID: ************, urlSchemeSuffix: 
, tokenCachingStrategy:<FBSessionTokenCachingStrategy: 
0xb73bd90>, expirationDate: (null), refreshDate: (null), 
attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(null)>}

2014-01-30 15:20:31.441 Unifeed[2140:70b] User cancelled login
2014-01-30 15:20:31.445 Unifeed[2140:70b] User logged out
- (void) facebookSessionChange {
// If the session state is any of the two "open" states when the button is clicked
if (FBSession.activeSession.state == FBSessionStateOpen
    || FBSession.activeSession.state == FBSessionStateOpenTokenExtended) {

    // Close the session and remove the access token from the cache
    // The session state handler (in the app delegate) will be called automatically
    [FBSession.activeSession closeAndClearTokenInformation];

    // If the session state is not any of the two "open" states when the button is clicked
} else {
    // Open a session showing the user the login UI
    [FBSession openActiveSessionWithReadPermissions:permissions
                                       allowLoginUI:YES
                                  completionHandler:
     ^(FBSession *session, FBSessionState state, NSError *error) {
         [self sessionStateChanged:session state:state error:error];
     }];
}
 }

 - (void)sessionStateChanged:(FBSession *)session state:(FBSessionState) state error:(NSError *)error
 {

NSLog(@"Session is %@", session);
// If the session was opened successfully
if (!error && state == FBSessionStateOpen){
    NSLog(@"Session opened");
    // Show the user the logged-in UI
    [self userLoggedIn];
    return;
}
if (state == FBSessionStateClosed || state == FBSessionStateClosedLoginFailed){
    // If the session is closed
    NSLog(@"Session closed");
    // Show the user the logged-out UI
    [self userLoggedOut];
}

// Handle errors
if (error){
    NSLog(@"Error occured %@", error);
    if ([FBErrorUtility shouldNotifyUserForError:error] == YES){
        NSLog(@"Error occured %@", error);
    } else {

        // If the user cancelled login, do nothing
        if ([FBErrorUtility errorCategoryForError:error] == FBErrorCategoryUserCancelled) {
            NSLog(@"User cancelled login");

            // Handle session closures that happen outside of the app
        } else if ([FBErrorUtility errorCategoryForError:error] == FBErrorCategoryAuthenticationReopenSession){
            NSLog(@"Session is no longer valid");

        } else {
            //Get more error information from the error
            NSDictionary *errorInformation = [[[error.userInfo objectForKey:@"com.facebook.sdk:ParsedJSONResponseKey"] objectForKey:@"body"] objectForKey:@"error"];
            NSLog(@"Error occured : %@", [errorInformation objectForKey:@"message"]);
        }
    }
    // Clear this token
    [FBSession.activeSession closeAndClearTokenInformation];
    // Show the user the logged-out UI
    [self userLoggedOut];
}
}

// Show the user the logged-out UI
- (void)userLoggedOut 
{
    NSLog(@"User logged out");
}

// Show the user the logged-in UI
- (void)userLoggedIn 
{
    NSLog(@"User Logged in");
    [_delegate doneLogginginToFb];
}