ios - Facebook 图 GET 请求

标签 ios objective-c facebook parse-platform

我的应用程序在向端点 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 的某些信息?任何帮助,将不胜感激。谢谢!

最佳答案

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

祝你好运!

关于ios - Facebook 图 GET 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33070359/

相关文章:

php - Facebook OAuth 和 PHP SDK...错误

objective-c - 如何找出NSEvent点击事件来自mouseClick或trackpad Click?

javascript - 使用 Phonegap 下载文件时 iOS 应用程序崩溃

iPhone - 动态改变颜色

html - 登录插件扰乱了 HTML DOM 结构

ios - swift 提出 Unresolved 标识符

iOS - 与 Jenkins/FaSTLane 持续集成

objective-c - 报亭应用订阅(应用内购买)困惑

ios - 如何在 Swift 中正确计算年龄?

android - Facebook 图片无法在 Android 中加载