我使用Facebook的SDK來獲得用戶的詳細信息,權限爲:從Facebook SDK檢索國家 - IOS
[NSArray arrayWithObjects:@"user_photos",@"public_profile",@"user_location", @"user_birthday",nil];
我知道如何讓這個城市,但我怎麼能得到用戶的國家?
FBRequest *request = [FBRequest requestForMe];
[request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{
if (!error)
{
NSDictionary *userData = (NSDictionary *)result;
NSString *facebookID = userData[@"id"];
NSString *name = userData[@"name"];
NSString *city = userData[@"location"][@"name"];
}
else
{
//...
}
}];
嘗試'[@「location」] [@「country」]'。所有你需要的是這裏https://developers.facebook.com/docs/graph-api/reference/v2.2/page/?locale=en – Ryan
謝謝你,但它返回爲nil = \ –