gpt4 book ai didi

ios - requestAccessToAccountsWithType 返回 "(NULL)"的 NSError

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:42:19 25 4
gpt4 key购买 nike

我正在使用此代码连接到 Facebook。它是第一次工作。然后我进入我的设置应用程序并撤销权限。然后我回到我的应用程序并再次运行此代码。 granted 返回 NOerror 不包含任何数据,我期待错误 code 6,但我获取 "(null)"

    if (!_accountStore) _accountStore = [[ACAccountStore alloc] init];

ACAccountType *fbActType = [_accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];

// Permissions
NSArray *permissions = [NSArray arrayWithObject:@"email"];
NSMutableDictionary *options = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"##########", ACFacebookAppIdKey,
permissions, ACFacebookPermissionsKey,
nil];


// requestAccessToAccountsWithType
[_accountStore requestAccessToAccountsWithType:fbActType options:options completion:^(BOOL granted, NSError *error) {

if (granted) {
// do something if we have access
} else {
NSLog(@"%@",error); // this returns "(null)"
}

知道为什么会这样吗?

最佳答案

我遇到了这个问题,只是在我的案例中偶然发现了答案。 this other question的答案居然帮我找到了。

  1. 我在 developers.facebook.com(设置 -> 高级)中将我的 Facebook 应用程序启用为 native 应用程序。

  2. 我的第一个请求是对@“email”的阅读。

    NSDictionary *options = @{
    ACFacebookAppIdKey: @“MY_FB_APP_ID",
    ACFacebookPermissionsKey: @[@"email"],
    };

这似乎“启动了泵”,随后对其他权限的请求(读取和写入必须单独请求)效果很好。例如:

NSDictionary *options = @{
ACFacebookAppIdKey: @“MY_FB_APP_ID",
ACFacebookPermissionsKey: @[@"email",
@"user_friends"],
};

关于ios - requestAccessToAccountsWithType 返回 "(NULL)"的 NSError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16601025/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com