2016-02-09 174 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

相關問題