在iPhone iOS上获取特定的Facebook用户数据字段

时间:2011-08-17 13:01:11

标签: ios facebook facebook-graph-api

嗨,我正在以字符串格式捕获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"
}

1 个答案:

答案 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;
    }