首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >IOS7 - [ACAccountStore requestAccessToAccountsWithType -“错误代码8”

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

Stack Overflow用户
提问于 2013-10-18 11:39:59
回答 1查看 2.3K关注 0票数 0

我已经找到了这个错误的其他主题,但是每个人都可以看到,我的NSDictionary是OK的-在其他答案中,问题是options参数。

我正在使用XCode5,并在IOS7上运行

代码语言:javascript
复制
 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

EN

回答 1

Stack Overflow用户

发布于 2013-10-18 11:59:11

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

FACEBOOK_APP_ID应为NSString

在我声明它为long long之前

代码语言:javascript
复制
static long long *const FACEBOOK_APP_ID = @"249292141827474";
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19441186

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档