2011-10-31 84 views
1

你能不能幫我正確解析響應: 分析器在 - (空)要求:(FBRequest *)要求didLoad:(ID)結果:解析響應的Facebook的iOS SDK

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]; 
} 

但它返回數組與空值。怎麼了?

回答

1

首先你需要設置權限如此 - 「user_education_history」

我糾正代碼爲您解析部分,因爲你有重要的教育收到字典,包括你的學校的陣列。

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

它適合我。

+0

謝謝! Loks太棒了! – Yaz