[英]get the value of ID from json response
I am new in iPhone App Development. 我是iPhone App开发的新手。 I wants to get User Id (my id) from Facebook.
我想从Facebook获取用户ID(我的ID)。 How can I get the ID?
我如何获得ID? the output in console is below.
控制台中的输出如下。
thanks 谢谢
- (void)request:(FBRequest *)request didLoad:(id)result
{
NSLog(@"result is %@",result);
}
Output in console is here: 控制台中的输出在这里:
{
email = "kestwalg@gmail.com";
"first_name" = Gaurav;
gender = male;
hometown = {
id = 1231243212321;
name = Haridwar;
};
id = 1213213231231;
"last_name" = K;
link = "http://www.facebook.com/kestwal.75";
locale = "en_US";
location = {
id = 123123123123;
name = "New Delhi, India";
};
name = "Gaurav Kestwal";
timezone = "5.5";
"updated_time" = "2012-07-10T06:46:25+0000";
username = "gaur.75";
verified = 1;
work = (
{
employer = {
id = 12312312312;
name = "NKAPs Intellects Noida";
};
position = {
id = 213123123213;
name = "iPhone Application Developer";
};
"start_date" = "0000-00";
}
);
} }
You just need to parse it, luckily there are a number of ways to do so easily in iPhone. 您只需要解析它,幸运的是,有多种方法可以在iPhone中轻松地做到这一点。 You can use this framework for instance: JSON framework
您可以使用此框架作为示例: JSON框架
Try that: 试试看:
- (void)request:(FBRequest *)request didLoad:(id)result {
NSString *jsonString = [NSString stringWithString:[result JSONRepresentation]];
NSDictionary *userDict = [jsonString JSONValue];
// do something with the values in the dictionary...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.