我已经找到了这个错误的其他主题,但是每个人都可以看到,我的 NSDictionary 是好的 - 在其他答案中,问题是选项参数。
我正在使用 XCode5 并在 IOS7 上运行
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *facebookAccountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSDictionary *options = @{ACFacebookAppIdKey : @(FACEBOOK_APP_ID),
ACFacebookPermissionsKey : @[@"email", @"publish_stream"],
ACFacebookAudienceKey : ACFacebookAudienceFriends};
[accountStore requestAccessToAccountsWithType:facebookAccountType options:options completion:^(BOOL granted, NSError *error)
{
if (granted)
{
NSArray *accounts = [accountStore accountsWithAccountType:facebookAccountType];
if([accounts count]>0)
callbackSuccess();
} else {
callbackFailure(error);
}
}];
提到的类似主题:
调用 [ACAccountStore requestAccessToAccountsWithType] 时获取“错误代码 8” - iOS Facebook