1

我正在使用以下内容发布针对 facebook 分数 API 的分数

- (IBAction)postScoreClicked:(id)sender 
{
    AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    NSMutableDictionary * dict = [[NSMutableDictionary alloc]init];
    [dict setObject:@"1" forKey:@"score"];
    [[delegate facebook] requestWithMethodName:@"/563645402/scores" andParams:dict andHttpMethod:@"POST" andDelegate:self];
    NSLog(@"Posting a new score...");
}

但是,覆盖request didFailWithErrorI 可以清楚地看到正在记录以下错误:

Error Domain=facebookErrDomain Code=3 "The operation couldn’t be completed. (facebookErrDomain error 3.)" UserInfo=0x68982d0 {request_args=(
        {
        key = method;
        value = "/563645402/scores";
    },
        {
        key = sdk;
        value = ios;
    },
        {
        key = score;
        value = 1;
    },
        {
        key = "sdk_version";
        value = 2;
    },
        {
        key = format;
        value = json;
    },
        {
        key = "access_token";
        value = VALUE-REMOVED-FROM-POST;
    }
), error_msg=Unknown method, error_code=3}

根据API 文档

只要您拥有 publish_actions 权限,您就可以通过使用应用程序 access_token 向 /USER_ID/scores 发出 HTTP POST 请求来发布分数或用户

在我的登录控制器中,我设置了publish_actions这样的权限:

NSArray *permissions = [[NSArray alloc] initWithObjects:
                                    @"user_games_activity", 
                                    @"friends_games_activity",
                                    @"publish_actions",
                                    nil];
            [[myDelegate facebook] authorize:permissions];

不太确定我在这里缺少什么,有什么想法吗?

在 facebook 应用控制中心,我的应用注册为原生/桌面,并归类为游戏

4

0 回答 0