无法使用图谱API从Facebook获取用户数据

时间:2015-03-15 08:05:31

标签: ios facebook facebook-graph-api

我正在应用中制作用户的家乡,在个人资料屏幕上显示位置。我在使用开发人员帐户时获取所需数据,并在当前用户查看自己的配置文件时为每个用户获取数据。 但是当我试着查看其他人的个人资料时,我没有得到所需的数据。这是我如何获取数据的代码。

-(void)loadFbData{
    NSMutableString *graphPath = [NSMutableString stringWithFormat:@"/?id=%@",[self.user valueForKey:@"facebookId"]];
    [graphPath appendString:@"&fields=location,hometown,picture.width(640).length(342),name,gender,email,website"];
    [FBRequestConnection startWithGraphPath:graphPath completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
        if (!error) {
            dispatch_async(dispatch_get_main_queue(), ^{
                self.personalDataView.webLabel.text = [result objectForKey:@"website"];
                self.personalDataView.emailLabel.text = [result objectForKey:@"email"];
                self.personalDataView.webLabel.text = [result valueForKey:@"website"];
               self.profileBasicDataView.livesInLbl.text = [[result objectForKey:@"location"] objectForKey:@"name"];
                self.profileBasicDataView.fromLbl.text = [[result objectForKey:@"hometown"] objectForKey:@"name"];
            });
            NSURL *url = [NSURL URLWithString:[[result objectForKey:@"picture"] valueForKeyPath:@"data.url"]];
            [self.profileBasicDataView loadUserFbData:result];
            [self.profileImage loadImage:url];
        }
    }];
}

**显示其他用户的个人资料时隐藏了网站和电子邮件。

0 个答案:

没有答案