简体   繁体   English

如何使用图形API,目标C将本地图像发布到用户的朋友墙?

[英]How to post local image to user's friends wall using graph api, objective c?

I've try so many time to figure it out but it still not working. 我已经尝试了很多时间弄清楚了,但仍然无法正常工作。

NSString *full = [[NSBundle mainBundle] pathForResource:@"200" ofType:@"png"];
UIImage *image = [UIImage imageWithContentsOfFile:full];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               image,@"picture",
                               @"OK! I just trying to test",@"message",nil];
[facebook requestWithGraphPath:@"My_Friend_ID/feed" andParams:params andHttpMethod:@"POST" andDelegate:self];

This code post only message on my friend wall not with the image, I also try with this: 此代码仅在我的朋友墙上发布消息,但不包含图片,我也可以尝试以下操作:

[facebook requestWithGraphPath:@"My_Friend_ID/photos" andParams:params andHttpMethod:@"POST" andDelegate:self];

This code dose post image on current user instead! 此代码将图像发布到当前用户身上!

Can someone help? 有人可以帮忙吗?

I was unaware you can HTTP POST a photo directly to a friends stream or album. 我没有意识到您可以将照片直接HTTP POST到朋友流或相册。 However, you can for the current logged in user IF you have publish_stream permissions. 但是,如果您具有publish_stream权限,则可以为当前登录的用户使用。 Please note, a app user cannot grant you friends_publish_stream because that permissions just doesn't exist. 请注意,应用程序用户无法授予您friends_publish_stream权限,因为该权限不存在。


From the docs http://developers.facebook.com/docs/reference/api/user/ 从文档http://developers.facebook.com/docs/reference/api/user/

PHOTO connection of User 用户的照片连接

Create 创造

You can post photos to a user's Wall on their behalf by issuing an HTTP POST request to PROFILE_ID/photos with the publish_stream permissions and the following parameters. 您可以通过发布具有publish_stream权限和以下参数的PROFILE_ID/photos HTTP POST请求,来代表用户将照片发布到用户的Wall。


And from albums docs: http://developers.facebook.com/docs/reference/api/album/ 并从相册文档中获取: http : //developers.facebook.com/docs/reference/api/album/

PHOTOS connection of Album 相簿的PHOTOS连接

Create 创造

You can add photos to an album by issuing an HTTP POST request to ALBUM_ID/photos with the publish_stream permissions and the following parameters. 您可以通过使用publish_stream权限和以下参数向ALBUM_ID /照片发出HTTP POST请求,将照片添加到相册。


Here's some examples for iOS on how to upload a photo from the phone to a user's wall or album. 这是iOS的一些示例,说明如何将照片从手机上传到用户的墙或相册。

http://www.raywenderlich.com/1626/how-to-post-to-a-users-wall-upload-photos-and-add-a-like-button-from-your-iphone-app http://www.raywenderlich.com/1626/how-to-post-to-a-users-wall-upload-photos-and-add-a-like-button-from-yphone-app

http://www.icodeblog.com/2011/03/28/facebook-sdk-posting-to-user-news-feed/ http://www.icodeblog.com/2011/03/28/facebook-sdk-posting-to-user-news-feed/

http://blog.anscamobile.com/2011/12/uploading-photos-to-facebook-in-corona/ http://blog.anscamobile.com/2011/12/uploading-photos-to-facebook-in-corona/

I don't think you can set an image file as an argument for posting to another user's wall. 我认为您不能将图像文件设置为参数以发布到其他用户的墙上。 You can, however, post a link. 但是,您可以发布链接。
See Facebook's docs. 请参阅Facebook的文档。 Check the section about a Post's fields: 检查有关帖子字段的部分:

https://developers.facebook.com/docs/reference/api/post/ https://developers.facebook.com/docs/reference/api/post/

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

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