ios - 使用 Facebook 登录解析 : Server refused renewal request with error code: 190

标签 ios facebook facebook-ios-sdk parse-platform

我正在开发一个使用 Parse 和 Facebook 的 iOS 应用。

对于 Facebook 登录,我遵循此页面上的指南:https://www.parse.com/tutorials/integrating-facebook-in-ios

按照指南,我有这段验证缓存 session 的代码:

// check if this cached session is still valid?
// does nothing if still valid
- (void) validateCachedSession
{
    FBRequest *request = [FBRequest requestForMe];
    [request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
        if (!error)
        {
            // handle successful response
            LogObvious(@"Facebook session validated. No problem");
        }
        else if ([error.userInfo[FBErrorParsedJSONResponseKey][@"body"][@"error"][@"type"] isEqualToString:@"OAuthException"])
        {   // Since the request failed, we can check if it was due to an invalid session
            LogObvious(@"The facebook session was invalidated. Announce logged Out");

            // The persisted session is invalid. Logout!
            [self logout];
        }
        else
        {
            LogObvious(@"The facebook session was invalidated. Announce logged Out");

            // The persisted session is invalid. Logout!
            [self logout];
        }
    }];
}

如上所示,如果缓存的session无效,应该调用注销:

- (void) logout
{
    [PFUser logOut];
    // Over here we will show the login button again.
}

为了测试这个。我首先使用 Facebook 帐户登录我的应用程序。然后,我更改了密码并重新访问该应用程序。

应用程序正确识别 session 无效并调用注销。

但是当我再次点击登录时,登录函数返回了这个错误:

Uh oh. An error occurred: Error Domain=com.facebook.sdk Code=5 "The operation couldn’t be completed. (com.facebook.sdk error 5.)" UserInfo=0x1e066140 {com.facebook.sdk:ErrorInnerErrorKey=Error Domain=com.apple.accounts Code=1 "Server refused renewal request with error code: 190" UserInfo=0x1d56df10 {NSLocalizedDescription=Server refused renewal request with error code: 190}, com.facebook.sdk:ParsedJSONResponseKey={
    body =     {
        error =         {
            code = 190;
            "error_subcode" = 65001;
        };
    };
}}

为什么?即使我终止应用程序并重新启动它。该应用程序现在将停留在这种状态 - 无法登录。任何帮助将不胜感激。

p/s: 说清楚,这是我的登录函数:

// to be called when user explicitly clicked a login button
- (void) loginByFacebookWithPermissions:(NSArray*)permissionsArray
{
    LogFunctionCalledObvious();
    [PFFacebookUtils logInWithPermissions:permissionsArray block:^(PFUser *user, NSError *error)
    {
        if (!user)
        {
            if (!error)
            {
                NSLog(@"Uh oh. The user cancelled the Facebook login.");
            } else
            {
                NSLog(@"Uh oh. An error occurred: %@", error);
                [self logout];
            }
        } else if (user.isNew)
        {
            LogObvious(@"User with facebook signed up and logged in!");
            [self requestLoggedInUserInfo];
        } else
        {
            LogObvious(@"User with facebook logged in!");
            [self requestLoggedInUserInfo];
        }
    }];
}

p/s2: 好的,经过更多调查,它一直停留在这种状态,直到我转到“设置”->“Facebook”重新输入新密码。这是正确的行为吗?当我从 Facebook.com 更改 Facebook 密码时,iOS6 不应该立即提醒用户更改密码吗?

最佳答案

你的错误子代码指向这个

static const int FBSDKSystemPasswordErrorSubcode = 65001;

case FBSDKSystemPasswordErrorSubcode:
            case FBAuthSubcodePasswordChanged:
                if (subcode == FBSDKSystemPasswordErrorSubcode
                    || [FBErrorUtility fberrorIsErrorFromSystemSession:error]) {
                    userMessageKey = @"FBE:PasswordChangedDevice";
                    userMessageDefault = @"Your Facebook password has changed. To confirm your password, open Settings > Facebook and tap your name.";
                    shouldNotifyUser = YES;
                } else {
                    userMessageKey = @"FBE:PasswordChanged";
                    userMessageDefault = @"Your Facebook password has changed. Please log into this app again to reconnect your Facebook account.";
                }
                break;

您必须以某种方式向用户发送消息才能执行此操作

您的 Facebook 密码已更改。要确认您的密码,请打开“设置”>“Facebook”并点按您的姓名。

您的 Facebook 密码已更改。请再次登录此应用以重新连接您的 Facebook 帐户。

关于ios - 使用 Facebook 登录解析 : Server refused renewal request with error code: 190,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17349020/

相关文章:

ios - UITableViewAutomaticDimension 以及 heightForRow

facebook - Firefox 只有 : FB. 在 FB.init() 之前调用了 login()

php - 在 PHP 中使用 RegEx 从 URL 获取 Facebook 视频 ID 的多种变体

ios6 - 在设备上切换 FB 帐户时,iOS 6 上的 Facebook 授权失败

ios - 用户使用社交提供商的 [facebook] token 登录 QuickBlox

c++ - 如何创建 C/C++ 库并将其放入 iOS 版 Xcode 中?

ios - 图像亮度/对比度 - Xamarin iOS

android - 从移动应用程序中检测成功的 facebook 的最佳方法是什么?

ios - Facebook native 登录不会打开 facebook 应用程序,即使它已安装在设备中?

iOS Facebook SDK : An active access token must be used to query information about the current user