Facebook API:我不能在朋友的墙上或其他墙上发布消息

时间:2012-12-19 15:20:48

标签: facebook-graph-api

我不知道为什么我可以使用$post=$facebook->api('/me/feed','post','message');在我的墙上发布消息(只是消息,没有链接,没有视频,没有照片),但当我用friend_id或other_id替换'我'时,我无法发布消息,虽然我的应用程序有权在Feed上发布消息。

2 个答案:

答案 0 :(得分:1)

在用户朋友的墙上张贴是一项已弃用的功能,很快便无法使用,因为99%的案例都是不受欢迎的垃圾邮件。

见路线图:

https://developers.facebook.com/roadmap/

Removing ability to post to friends walls via Graph API

因此,如果您创建一个新的应用程序,“2013年2月的重大更改”将已经激活,现在不再可能了。这主要是出于垃圾邮件的原因,朋友墙上没有严肃的应用帖子。

答案 1 :(得分:0)

是的,但是在Facebook于2013年2月建立新的路线图之后,它是可能的。只需在您的项目中实施GarphAPI和ASIHTTPRequest,并使用下面的代码在朋友墙上发布带有图像的文本...

    NSString *urlString = [NSString stringWithFormat:@"https://graph.facebook.com/%@/photos?access_token=%@",[FRIEND_ID], fbGraph.accessToken];

    UIImage * pic = [UIImage imageNamed:@"image.png"];
    NSData *picData = UIImageJPEGRepresentation(pic, 1);
    NSURL *url = [NSURL URLWithString:urlString];
    ASIFormDataRequest *newRequest = [ASIFormDataRequest requestWithURL:url];
    [newRequest setPostValue:@"This is Sample Text" forKey:@"message"];
    [newRequest setData:picData forKey:@"data"];
    [newRequest setPostValue:fbGraph.accessToken forKey:@"access_token"];
    [newRequest setDelegate:self];
    [newRequest startAsynchronous];

这将100%欢呼。我现在正在使用它...顺便说一句,将FBGraph.h和ASIFormDataRequest.h导入到您的实现文件中。