OStack程序员社区-中国程序员成长平台

标题: ios - Facebook 开发者 API iOS,age_range 返回 NULL [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 00:15
标题: ios - Facebook 开发者 API iOS,age_range 返回 NULL

这是我的代码,我在这里做错了什么?请记住,我正在使用 FBLoginView 并且其他字符串返回实际有效结果,而不是年龄范围。在此先感谢,-丹尼尔

- (void)loginViewFetchedUserInfoFBLoginView *)loginView
                        userid<FBGraphUser>)user {

NSString *userID = [NSString stringWithFormat"%@", user.objectID]; //objectID instead?
NSLog(@"userID = %@", userID);

NSString *nameFull = [NSString stringWithFormat"%@", user.name];
NSLog(@"nameFull = %@", nameFull);

NSString *firstName = [NSString stringWithFormat"%@", user.first_name];
NSLog(@"firstName = %@", firstName);

NSString *middleName = [NSString stringWithFormat"%@", user.middle_name];
NSLog(@"middleName = %@", middleName);

NSString *lastName = [NSString stringWithFormat"%@", user.last_name];
NSLog(@"lastName = %@", lastName);

NSString *link = [NSString stringWithFormat"%@", user.link];
NSLog(@"link = %@", link);

NSString *gender = [NSString stringWithFormat"%@", [user objectForKey"gender"]];
NSLog(@"gender = %@", gender);

NSDictionary *ageRangeDict = [user objectForKey"user_age_range"];
NSString *ageRange = [NSString stringWithFormat"%@-%@",
                      [ageRangeDict objectForKey:@"min"],
                      [ageRangeDict objectForKey:@"max"]];

NSLog(@"ageRange = %@", ageRange);
}



Best Answer-推荐答案


改变这一行:

NSDictionary *ageRangeDict = [user objectForKey:@"user_age_range"];

到这里:

NSDictionary *ageRangeDict = [user objectForKey:@"age_range"];

引用:Link

关于ios - Facebook 开发者 API iOS,age_range 返回 NULL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25106602/






欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) Powered by Discuz! X3.4