【问题标题】:Get ACAccount Facebook user full name is null获取 ACAccount Facebook 用户全名为空
【发布时间】:2013-12-15 19:39:45
【问题描述】:

我正在尝试获取 Facebook 帐户的用户全名,该应用程序已经在 Facebook iPhone 设置中获得了权限,前几天这段代码可以工作,但不知道,我不明白为什么,这是代码:

ACAccountStore *accountStore = [[ACAccountStore alloc] init];

__block ACAccount *facebookAccount;

ACAccountType *facebookTypeAccount = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];

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

[accountStore requestAccessToAccountsWithType:facebookTypeAccount
                                      options:options
                                   completion:^(BOOL granted, NSError *error) {
                                       if(granted){
                                           NSArray *accounts = [accountStore accountsWithAccountType:facebookTypeAccount];
                                           facebookAccount = [accounts lastObject];
                                           NSLog(@"name: %@",[facebookAccount userFullName]);
                                           dispatch_async(dispatch_get_main_queue(), ^{
                                               [self.fb_name setText:[facebookAccount userFullName]];
                                           });

                                       }
                                   }];

这个:NSLog(@"name: %@",[facebookAccount userFullName]);null

【问题讨论】:

    标签: ios objective-c acaccount acaccountstore


    【解决方案1】:

    我相信 userFullName 仅在 iOS 7 之后才可用。也许您在 iOS 7 上进行了测试,但现在当您以 iOS 6 为目标时遇到了该问题。请参阅iOS: user's full name for an ACAccountTypeIdentifierFacebook 了解 iOS 6 后备。

    【讨论】:

      猜你喜欢
      • 2013-11-11
      • 2012-10-24
      • 1970-01-01
      • 2013-10-16
      • 1970-01-01
      • 2015-09-10
      • 2011-08-12
      • 2016-06-09
      • 1970-01-01
      相关资源
      最近更新 更多