简体   繁体   English

如何在iOS的好友墙上的Facebook中发布消息?

[英]How to post a message in facebook on a friends wall in iOS?

I'm trying to post a message on a friends wall using requestWithGraphPath:parameters:HTTPMethod: method but its not working. 我正在尝试使用requestWithGraphPath:parameters:HTTPMethod:方法在朋友墙上发布一条消息,但是它不起作用。

Here is my code, 这是我的代码,

-(void)shareAdOnFacebook
{
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setObject:@"Test post with silent authentication" forKey:@"message"];
    [params setObject:@"link" forKey:@"type"];
    [params setObject:@"http://yoursite.com" forKey:@"link"];
    [params setObject:@"Link description" forKey:@"description"];

    NSString *graphPath = @"[user_id]/feed";
    [FBRequest requestWithGraphPath:graphPath parameters:params HTTPMethod:@"POST"];
}

There is no error but it doesn't post anything. 没有错误,但未发布任何内容。 I'm trying to get it to work on iOS5 and above. 我正在尝试使其在iOS5及更高版本上运行。

Any advice? 有什么建议吗?

NSArray *permissions =[NSArray arrayWithObjects:@"publish_actions",@"publish_stream",@"manage_friendlists", nil];

[[FBSession activeSession] reauthorizeWithPublishPermissions:permissions defaultAudience:FBSessionDefaultAudienceFriends
                                           completionHandler:^(FBSession *session, NSError *error) {
                                               /* handle success + failure in block */
                                           }];

Source from: Referance 来源: 参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM