0

我已经找到了这个错误的其他主题,但是每个人都可以看到,我的 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

ACAccountStore 错误 6 (ACErrorAccountNotFound) 和 8

4

1 回答 1

0

花了很长时间,我发现了问题:

FACEBOOK_APP_ID 应该是一个 NSString

在我宣布它之前

static long long *const FACEBOOK_APP_ID = @"249292141827474";
于 2013-10-18T03:59:10.520 回答