gpt4 book ai didi

ios - 获取ACAccount Facebook用户全名为null

转载 作者:行者123 更新时间:2023-12-01 16:45:29 26 4
gpt4 key购买 nike

我正在尝试获取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

最佳答案

我相信userFullName仅在iOS 7以后可用。也许您在iOS 7上进行了测试,现在将iOS 6作为目标时遇到了问题。有关iOS 6后备广告的信息,请参见iOS: user's full name for an ACAccountTypeIdentifierFacebook

关于ios - 获取ACAccount Facebook用户全名为null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20288623/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com