ACAccountStore requestAccessToAccountsWithType:options:completion:返回nil错误并被授予NO

Ril*_*eyE 5 facebook ios acaccount acaccountstore

我正在尝试测试登录ACAccountStore,但是它不是很顺利.

我正试图访问该帐户,如下所示:

ACAccountStore *store = [ACAccountStore new];

ACAccountType *accountType = [store accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];

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

[store requestAccessToAccountsWithType:accountType
                               options:options
                            completion:^(BOOL granted, NSError *error)
 {
     NSLog(@"Access Granted: %d", granted);
     NSLog(@"Error: %@", error);
 }];
Run Code Online (Sandbox Code Playgroud)

但是,我的输出看起来像这样:

2013-09-30 16:58:08.084 Application[1009:1103] Access Granted: 0
2013-09-30 16:58:08.090 Application[1009:1103] Error: (null)
Run Code Online (Sandbox Code Playgroud)

我确保我在developers.facebook网站上的"Bundle ID"和我的应用程序Bundle Identifier匹配.我还设置了"沙箱模式".这就是我所需要的一切,对吧?出了什么问题?

此外,只是为了提供有关应用程序的更多信息,这个应用程序是骨干.这是一个空应用程序,其中一个视图控制器显示一个按钮,其中一个目标运行我上面编写的代码.这就是应用程序的全部内容.

jac*_*ack 0

检查developer.facebook.com,看看您的应用程序是否已被沙盒化。如果您的应用程序已被沙盒化并且您正在使用另一个 Facebook 帐户进行测试,那么肯定会是“否”。