2016-02-09 169 views
-1

我正在从图中的Facebook登录使用FBSDKGraphRequest用户数据..获取国家名称和时区

但不知道如何从数据中获得时区&只有国名..

我编码到现在是如下:

在结果
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] 
           initWithGraphPath:[NSString stringWithFormat:@"/%@",result.token.userID] 
           parameters:@{ @"fields" : @"id, name, email, first_name, hometown, last_name, location" } 
           HTTPMethod:@"GET"]; 
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { 
    [self handleRequestCompletionWithResult:result error:error]; 
}]; 

在这里我得到的数据.. !!!

+0

请求Facebook的权限是什么 –

+0

loginButton.readPermissions = @ [@“public_profile”,@“email”,@“user_friends”,@“user_hometown”,@“user_location”]; – Simmy

+0

如果需要,我可以添加更多的权限.. !!! – Simmy

回答

1

我不知道国家,但你可以通过在字段中加入timezone来获得时区。所有可用的字段可以在这里找到:User graph API

BTW,location该字段应返回该国家。

+0

Graph User api的新版本是[this](https://developers.facebook.com/docs/graph-api/reference/v2.5/user) – Simmy

+0

你可以发布代码来获取国家吗? – Simmy

相关问题