Facebook的iOS版SDK 3.0:如何使现有的URL有何评论?(Facebook iOS S

2019-07-31 04:20发布

有没有人尝试使用新的Facebook SDK发布到一个URL评论? 我尝试用startForPostWithGraphPath像这样(代码段从美味的项目挑选):

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!!");
                                 }
                             }];

它并不既不能从开放图谱API浏览器协同工作。 我收到的错误是“发生未知错误”,代码200。XXXXXXXX url是页面我有意见的ID,我都可以看,但不能正确发布到它们。 也许开图路径是错误的?

Answer 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


文章来源: Facebook iOS SDK 3.0: how to make comment to existing URL?