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