从Facebook帐户iOS请求信息

时间:2013-11-19 11:15:26

标签: ios facebook

我正在使用Facebook帐户制作应用登录功能。我通过运行此命令获得了Facebook tokenkeyappDelegate.session.accessTokenData.accessToken。然后我像这样usernameuser_ID

FBRequest *request = [FBRequest requestForMe];
[request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
    if (error == nil) {
        // result is a dictionary with the user's Facebook data
        NSDictionary *userData = (NSDictionary *)result;

        NSString *facebookID = userData[@"id"];
        NSLog(@"facebookID  = %@",facebookID);

if (FBSession.activeSession.isOpen) {
    [[FBRequest requestForMe] startWithCompletionHandler:
     ^(FBRequestConnection *connection, 
       NSDictionary<FBGraphUser> *user, 
       NSError *error) {
         if (!error) {
             self.userNameLabel.text = user.name;
             self.userProfileImage.profileID = user.id;
         }
     }];      
}

结果是一样的,当我调试时它总是在if(!error)中跳起来。

这个错误来自哪里?

0 个答案:

没有答案