【问题标题】:OSX ACAccountStore requestAccessToAccountsWithType... returning 'granted=No' and error=nil after denying permissionsOSX ACAccountStore requestAccessToAccountsWithType...在拒绝权限后返回“granted=No”和error=nil
【发布时间】:2015-01-21 02:14:39
【问题描述】:

我正在尝试请求访问我的 Facebook 帐户。我第一次运行它时运行良好,我看到了请求权限的弹出窗口。弹出窗口要求我允许或拒绝。我选择拒绝是因为我想测试那个用例。现在我无法弄清楚如何让它再次允许访问。我已经从我的 facebook 帐户中删除了该应用程序,并从我的 mac 中删除了我的 facebook 帐户。我也试过添加属性

@"auth_type": @"rerequest"

到选项字典。无论如何,我都会得到相同的结果。

如标题所述,error 为 nil,granted 为 False。

提前致谢。

ACAccountType* accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];

NSDictionary* options = @{
                          ACFacebookAppIdKey: [[NSBundle mainBundle] objectForInfoDictionaryKey:@"FacebookAppID"],
                          ACFacebookPermissionsKey: @[@"public_profile", @"email", @"user_friends"],
                          };

[accountStore requestAccessToAccountsWithType:accountType options:options completion:^(BOOL granted, NSError* error)
 {
        if (granted)
        {
            ACAccount* account = [[accountStore accountsWithAccountType:accountType] lastObject];
            macFacebookAccount = account;
        }
        else
        {
            NSLog(@"%@", error); 
        }
 }];

【问题讨论】:

  • 您是否在每次想要发出 Facebook 请求时都致电 requestAccessToAccountsWithType?还是检查用户是否已经授权了应用?

标签: objective-c facebook macos acaccount acaccountstore


【解决方案1】:

我解决了这个问题:应用程序的 Facebook 权限设置位于系统偏好设置 > 安全和隐私下。从那里只需点击 facebook 并选中您的应用旁边的框

【讨论】:

    猜你喜欢
    • 2014-09-19
    • 2013-10-06
    • 1970-01-01
    • 1970-01-01
    • 2018-08-20
    • 2021-10-12
    • 2014-02-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多