2013-10-21 40 views

回答

0

//調用Facebook的圖形API的用戶的

NSURL *requestURL = [NSURL URLWithString:@"https://graph.facebook.com/me"]; 



SLRequest *request = [SLRequest requestForServiceType:SLServiceTypeFacebook  requestMethod:SLRequestMethodGET URL:requestURL parameters:nil]; 
request.account = self.facebookAccount; 

[request performRequestWithHandler:^(NSData *data, NSHTTPURLResponse *response, NSError *error) 
{ 

if(!error) 
{ 

NSDictionary *list =[NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error]; 

//基本概況將在列表變量保存

NSLog(@"Dictionary contains: %@", list); 

fbID = [NSString stringWithFormat:@"%@", [list objectForKey:@"id"]]; 

//擷取的Facebook ID

gender = [NSString stringWithFormat:@"%@", [list objectForKey:@"gender"]]; 

//獲取性別 playerGender = [NSString stringWithFormat:@「%@」,gender]; NSLog(@「Gender:%@」,playerGender);

還導入社會帳戶和安全框架

相關問題