2

i'm trying to get the user full name of the Facebook account, the app already have the permissione in the Facebook iPhone setting, some day ago this code works, but know doesn't, i can't understand why, this is the code:

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]];
                                           });

                                       }
                                   }];

this: NSLog(@"name: %@",[facebookAccount userFullName]); is null

Piero
  • 9,173
  • 18
  • 90
  • 160

1 Answers1

0

I believe userFullName is only available since iOS 7. Maybe you tested on iOS 7 and now you are experiencing the issue when you target iOS 6. See iOS: user's full name for an ACAccountTypeIdentifierFacebook for the iOS 6 fallback.

Community
  • 1
  • 1
Jannie Theunissen
  • 28,256
  • 21
  • 100
  • 127