使用facebooksdk安排在Facebook页面上的帖子

时间:2017-04-24 11:35:47

标签: ios objective-c facebook facebook-page

我已经编写了以下代码在Facebook页面上发布但收到此错误消息:“(#200)未发布的帖子必须作为页面本身发布到页面。”;

NSString *accesstoken = @"EAACEdEose0cBAAe49xNZBS5MqswXkRptXgLDRuZBZBPZCZCVl5rxW6Bt0jthaHXMACNTiUWePg9XkVTpttDNsLyWYBaEkQaUCm5vbSJQh8zGwkegAcQRjRggAJajunmMyg0jVIKZAZBzMjbZCKWUv1Tie1UzF8gJCpIxACIVgqx7SqKdPZBnIUaElk3meB7SYo6AZD";
NSString *pageId = [dic valueForKey:@"id"];
NSDictionary *dicPara=@{@"message": @"Hello",@"access_token":accesstoken,@"scheduled_publish_time": [NSNumber numberWithInt:timestamp],@"published": @"false"};
NSLog(@"%@",dicPara);

  FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                                              initWithGraphPath:[NSString stringWithFormat:@"/%@/feed",pageId]
                                              parameters:dicPara
                                              HTTPMethod:@"POST"];
  [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
                    // Insert your code here

          if (error)
          {
               NSLog(@"%@",error);
          }
          else
          {
               [arrPostId addObject:[result valueForKey:@"id"]];
          }
     }];

现在我已经搜索了这个错误,发现你必须设置页面的accessstoken而不是用户的令牌。那么如何才能将用户的访问令牌更改为页面访问权限?

0 个答案:

没有答案