【问题标题】:Facebook Graph GET RequestFacebook 图表 GET 请求
【发布时间】:2015-10-11 21:37:14
【问题描述】:

我的应用在向端点 me 的 Facebook API 发出 GET 请求时收到错误。

这是我的代码:

-(void) updateUserInformation{
    FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/me:" parameters:@{@"fields": @"id, name, email, user_birthday"}];

    [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
        if(!error){
            NSDictionary *userDictionary = (NSDictionary *)result;
            NSMutableDictionary *userProfile = [[NSMutableDictionary alloc] initWithCapacity:8];

            if (userDictionary[@"name"]) {
                userProfile[@"name"] = userDictionary[@"name"];
            }

            if (userDictionary[@"first_name"]) {
                userProfile[@"first_name"] = userDictionary[@"first_name"];
            }

            if (userDictionary[@"location"][@"name"]) {
                userProfile[@"location"] = userDictionary[@"location"][@"name"];
            }

            if (userDictionary[@"gender"]) {
                userProfile[@"gender"] = userDictionary[@"gender"];
            }

            if (userDictionary[@"birthday"]) {
                userProfile[@"birthday"] = userDictionary[@"birthday"];
            }
            if (userDictionary[@"interested_in"]) {
                userProfile[@"interested_in"] = userDictionary[@"interested_in"];
            }

            [[PFUser currentUser] setObject:userProfile forKey:@"profile"];

            [[PFUser currentUser] saveInBackground];

        }else {
            NSLog(@"Error in Facebook Request %@", error);
        }

    }];
}

我得到的错误是:

2015-10-11 14:30:59.306 MatchedUp[2358:139193] Error in Facebook Request Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=803, com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
    body =     {
        error =         {
            code = 803;
            "fbtrace_id" = "CfGbwnx4/B9";
            message = "(#803) Some of the aliases you requested do not exist: me:";
            type = OAuthException;
        };
    };
    code = 404;
}, com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=404, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=(#803) Some of the aliases you requested do not exist: me:, com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=0}

我不太确定这个错误是什么意思。它说“您请求的某些别名不存在:我:”这是否意味着 completionHandler 中的结果字典不包含端点 me 的某些信息?任何帮助,将不胜感激。谢谢!

【问题讨论】:

    标签: ios objective-c facebook parse-platform


    【解决方案1】:

    尝试将图形路径 @"/me:" 更改为 @"me"

    祝你好运!

    【讨论】:

    • 天啊,非常感谢!!!我不敢相信这是一个如此简单的错误哈哈......有时只需要另一双眼睛就能捕捉到这些错误:)
    • 您是否知道我如何获得有关用户的更多信息?我只在完成处理程序中传回的结果中获取名称和 ID。我还想要邮箱、生日、性别、兴趣等。
    • @1290:需要额外的字段,见stackoverflow.com/a/32585470/1427878
    • @CBroe 您提供的 stackoverflow 帖子是针对我认为的 Web 应用程序的? iPhone应用程序的工作方式是否相同?由于在 Facebook 文档中声明我需要从 Facebook 获得额外的权限,并询问他们是否可以获得对某些权限的访问权限。
    • 当然,您需要先获得权限,您的应用所在的平台不会改变这一点。而且,您现在需要专门要求这些附加字段也不会改变。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-26
    • 2015-03-09
    • 2011-12-11
    • 1970-01-01
    • 1970-01-01
    • 2020-08-24
    • 2015-12-07
    相关资源
    最近更新 更多