IOS7 - [ACAccountStore requestAccessToAccountsWithType - “错误代码8”

时间:2013-10-18 03:39:59

标签: ios objective-c acaccountstore

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

提到的类似主题:

Getting "Error Code 8" When Calling [ACAccountStore requestAccessToAccountsWithType] - iOS Facebook

ACAccountStore Error 6 (ACErrorAccountNotFound) and 8

1 个答案:

答案 0 :(得分:0)

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

FACEBOOK_APP_ID应该是NSString

在我宣布之前很久

static long long *const FACEBOOK_APP_ID = @"249292141827474";