ios - 如何在 iOS 中以 pageadmin 身份在 Facebook 页面上发布状态提要?

标签 ios iphone xcode facebook facebook-graph-api

我想在我的 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);
     }
 }];

消息状态已发布完成页面墙,但该状态来 self 的名字。 但是,当我尝试使用 page_id/feed POST 查询和相同的参数 @"this is my status"@"message"从 graph api explorer 页面点击相同的 post 方法时,它从不是我的页面发布状态。

请帮忙。

最佳答案

 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];

关于ios - 如何在 iOS 中以 pageadmin 身份在 Facebook 页面上发布状态提要?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26141394/

相关文章:

iphone - 使用 ASIHTTPRequest 通过 NSDictionary 发布嵌套参数

iphone - Objective-C 表单框架

iphone - 由于 UIWebview 应用程序被 App Store 拒绝

android - Android 中是否有与 NotificationListenerService 等效的 iOS?

ios - 是否可以根据 map View 的中心抓取城市等信息

ios - 如何将用户重定向到开发者iTunes帐户以查看他的其他应用

iphone - 触摸 UITableViewCell 中的 UIButton 无法滚动表格

ios - Swift CollectionView 自定义布局单元格间距

c - 使用 XCode 通过 K&R 学习 C,但错误太多

ios - 为什么 Unity3D 应用程序 [导出到 Xcode 项目] 会因为 ip_unity_plugin.bundle 有 "unsealed contents present in the bundle root"而失败?