解析Facebook iOS sdk的反应

时间:2011-10-31 15:18:15

标签: ios facebook json parsing sdk

你能帮我解析一下你的答案: 解析器 - (void)请求:(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];
}

但它返回带有null的数组。怎么了?

1 个答案:

答案 0 :(得分:1)

首先,您需要为此设置权限 - “user_education_history”

我更正了您的解析部分的代码,因为您的接收字典包含由您的学校阵列组成的关键教育。

NSArray *arrayRsult = [result objectForKey:@"education"];
for (NSDictionary *placeForResults in arrayRsult){
    NSString *output = [[placeForResults objectForKey:@"school"] objectForKey:@"name"];
    NSLog(@"%@", output);
}

它对我有用。