嗨,我正在以字符串格式捕获Facebook详细信息,但我只想要id和用户名。如何分离这些数据。我的数据是:
fbString是
{
"id":"100002257451995",
"name":"Mustacheiphone Mustache",
"first_name":"Mustacheiphone",
"last_name":"Mustache",
"link":"http:\/\/www.facebook.com\/profile.php?id=100002257451995",
"gender":"male","email":"mustacheiphone\u0040gmail.com",
"timezone":5.5,"locale":"en_US","verified":true,
"updated_time":"2011-04-11T11:28:22+0000"
}
答案 0 :(得分:0)
i got it this way i was capture the userid
SBJsonParser *parser = [[SBJsonParser alloc]init];
NSDictionary *facebookInfo = [[parser objectWithString:fbString error:nil] copy];
[parser release];
if(facebookInfo != nil)
{
//NSDictionary *data = (NSDictionary *) [facebookInfo objectAtIndex:0];
NSString *faceBoookID = (NSString *) [facebookInfo objectForKey:@"id"];
NSLog(@"the faceBookID is %@",faceBoookID);
// appDelegate.FBID = faceBoookID;
NSString *useremail = (NSString *) [facebookInfo objectForKey:@"email"];
NSLog(@"the faceBookemail is %@",useremail);
// appDelegate.FBEMAIL = useremail;
}