您能帮我正确解析响应吗:
解析器-(void)request:(FBRequest *)请求didLoad:(id)结果:
case education:{
NSArray *arrayRsult = [[result objectForKey:@"education"] objectForKey:@"school"];
for (NSDictionary *placeForResults in arrayRsult){
NSString *output = [placeForResults objectForKey:@"name"];
NSLog(@"%@", output);
}
}
break;
我的请求:
- (IBAction)eduacation:(id)sender {
currentApiCall = education;
FacebookInfoGetterAppDelegate *delegate = (FacebookInfoGetterAppDelegate *) [[UIApplication sharedApplication] delegate];
[[delegate facebook] requestWithGraphPath:@"me?fields=education" andDelegate:self];
}
但是它返回带有空值的数组。怎么了?
最佳答案
首先,您需要为此设置权限-“ user_education_history”
我更正了您的解析部分的代码,因为您收到的字典包含具有重要教育背景的字典,其中包括您的学校。
NSArray *arrayRsult = [result objectForKey:@"education"];
for (NSDictionary *placeForResults in arrayRsult){
NSString *output = [[placeForResults objectForKey:@"school"] objectForKey:@"name"];
NSLog(@"%@", output);
}
这个对我有用。