【问题标题】:How to post status feed on Facebook page as pageadmin in iOS?如何在 iOS 中以 pageadmin 身份在 Facebook 页面上发布状态提要?
【发布时间】:2014-10-01 12:29:02
【问题描述】:

我想在我的 Facebook 页面上发布状态。状态应在 Facebook 上显示为页面状态,而不是来自任何用户名或我的姓名的状态。

我试过下面的代码,

 NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:@"This is a check for page post message", @"message", nil];

/* make the API call */
[FBRequestConnection startWithGraphPath:@"/1521177224766299/feed"
                             parameters:params
                             HTTPMethod:@"POST"
                      completionHandler:^(FBRequestConnection *connection, id result, NSError *error){
     if (result)
     {
         NSLog(@"Result %@", result);
     }
     else
     {
         NSLog(@"%@", error);
     }
 }];

消息状态已发布完成页面墙,但该状态来自我的名字。 但是,当我尝试使用 page_id/feed POST Query 和相同的参数 @"this is my status" @"message" 从图形 api 资源管理器页面点击相同的发布方法时,它从页面而不是我发布状态。

请帮忙。

【问题讨论】:

  • 您想以管理员身份在页面名称中将消息作为页面发布

标签: ios iphone xcode facebook facebook-graph-api


【解决方案1】:
 NSString *accesstoken=[NSString stringWithFormat:@"%@","here add your page access_token"];

    NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
                            accesstoken, @"access_token",
                            postingString, @"message",

                           // @"http://www.real-timesports.com", @"link",


                            nil];

    FBRequest *requestToPost = [[FBRequest alloc] initWithSession:nil
                                                        graphPath:@"/me/feed"
                                                       parameters:params
                                                       HTTPMethod:@"POST"];


    NSLog(@"requestToPost==%@",requestToPost);

    FBRequestConnection *requestToPostConnection = [[FBRequestConnection alloc] init];
    [requestToPostConnection addRequest:requestToPost completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
     {


         NSLog(@"facebook result >> %@", result);


     }];
    [requestToPostConnection start];

【讨论】:

  • 这已成功发布为页面管理员名称而不是您的名称
  • 如果你有任何疑问,我会解释你
  • 它工作了几次,然后我再次启动应用程序并尝试它返回 NULL。脸书结果>>(空)
  • 检查您的权限是被授予还是被拒绝,如果被授予它工作正常
【解决方案2】:

这是完整的答案

NSString *accesstoken = <Facebook_Page_Access_Token>

  NSDictionary*  params = [NSDictionary dictionaryWithObjectsAndKeys:
              @"Post heading", @"name",
              accesstoken, @"access_token",
              @"Type post message", @"message",
              @"Hyperlink to your post", @"link",
              @"Add description", @"description",
              @"Image url string", @"picture",
              nil];

    FBRequest *requestToPost = [[FBRequest alloc] initWithSession:nil
                                                        graphPath:@"/me/feed"
                                                       parameters:params
                                                       HTTPMethod:@"POST"];    

    FBRequestConnection *requestToPostConnection = [[FBRequestConnection alloc] init];
    [requestToPostConnection addRequest:requestToPost completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
     {
         if (!error) {             
             NSLog(@" %@", result);             
         }
         else
         {
             NSLog(@"%@", error);                        
         } 

     }];

【讨论】:

  • 请确保您的 Facebook 应用 ID 在状态和评论中有 manage_pages 和 publish_pages。首先获取您的页面令牌,然后使用上面的代码进行共享。有什么问题可以问我。
猜你喜欢
  • 2014-07-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-11-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多