2

有没有人尝试使用新的 Facebook SDK 向 URL 发表评论?我尝试使用这样的 startForPostWithGraphPath (从 Scrumptious 项目中挑选的代码片段):

id action = [FBGraphObject graphObject];
[action setValue:@"test from iOS app" forKey:@"message"];

// Create the request and post the action to my url path.
[FBRequestConnection startForPostWithGraphPath:@"XXXXXXXXXXXXXXXXXXX/comments"   
                                   graphObject:action
                             completionHandler:^(FBRequestConnection *connection,
                                                 id result,
                                                 NSError *error) {
                                 if (error)
                                 {
                                     NSLog(@"error: %@", error.localizedDescription);
                                 }
                                 else
                                 {
                                     NSLog(@"ok!!");
                                 }
                             }];

它在 Open Graph API 资源管理器中也不起作用。我收到的错误是“发生了未知错误”,代码 200。XXXXXXXX 网址是我有评论的页面的 ID,我可以阅读它们,但无法正确发布给它们。也许开放的图形路径是错误的?

4

1 回答 1

1

嘿,朋友,这对你来说是个好消息。

我在 IOS 中使用 GraphAPI 发表评论和点赞

只需在下面写一些代码。

         NSMutableDictionary *res = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"This is my comment", @"message", @"Your api's access Token",@"access_token",nil];
        [FBRequestConnection startWithGraphPath:@"XXXXXXXXXX/comments" parameters:res HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
            if (error)
            {
                   NSLog(@"error: %@", error.localizedDescription);
            }
            else
            {
                   NSLog(@"ok!!");
            } 
        }];
        XXXXXXXXXX = Id where you want to comment.

笔记:-

Please do not appent https://graph.facebook.com 

XXXXXXXXXX/comments
于 2012-12-22T09:08:18.763 回答