在iOS应用中发表对Facebook的评论

时间:2017-05-23 10:56:39

标签: objective-c facebook facebook-graph-api

我试图用以下方法评论应用程序中的Facebook帖子:

NSDictionary *params = @{
                             @"message": @"test message",
                             @"access_token": [FBSDKAccessToken currentAccessToken].tokenString,
                             @"app_id": @"1288902784652019",
                             @"app_secret": @"bhjijsidjeiwdjdjjkrhecb232ff3020"
                             };
// 81 is the post id
    FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                                  initWithGraphPath:@"/81"
                                  parameters:params
                                  HTTPMethod:@"POST"];
    [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection,
                                          id result,
                                          NSError *error) {
        NSLog(@"result..%@",result);
        NSLog(@"error..%@",error);
        // Handle the result
    }];

我收到了以下回复:

body =     {
        error =         {
            code = 240;
            "fbtrace_id" = E4HZyWR32MY;
            message = "(#240) Requires a valid user to be specified (either via the session or via the API parameter for specifying the user.";
            type = OAuthException;
        };
    };
    code = 403;
}}

任何人都可以告诉我我做错了什么。或者是否有其他方式发表评论。请指教。

谢谢!

0 个答案:

没有答案