Facebook SDK iOS:添加帖子以供图像 [英] Facebook SDK iOS: Add post to feed with image
本文介绍了Facebook SDK iOS:添加帖子以供图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经弄清楚如何在我的用户资讯提供中添加文章,但目前需要使用图片网址:
I have figured out how to add a post to my users feed, but currently it requires using an image URL:
// The action links to be shown with the post in the feed
NSArray* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
self.title,@"name",self.url,@"link", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
// Dialog parameters
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
self.title, @"name",
@"Created using My App.", @"caption",
@"Check out the thing I just uploaded!", @"description",
self.url, @"link",
@"http://www.facebookmobileweb.com/hackbook/img/facebook_icon_large.png", @"picture",
actionLinksStr, @"actions",
nil];
[facebook dialog:@"feed" andParams:params andDelegate:self];
我想上传一个 UIImage
。我已经看到有人在谈论使用图表api
。我如何做到这一点,仍然可以使用标题,标题和消息?
I would like to upload a UIImage
instead. I have seen some people talking about using the graph api
for this. How would I do this and still be able to use a caption, title and message?
推荐答案
将四行代码替换为这两个:
Replace your four lines of code by these two :
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:YourUIImage, @"source",@"caption description",@"message", nil];
[facebook requestWithGraphPath:[NSString stringWithFormat:@"/me/photos?access_token=%@", facebook.accessToken] andParams:params andHttpMethod:@"POST" andDelegate:self];
和'YourUIImage'。
希望我回答你的问题!
and 'YourUIImage' by your UIImage. Hope I answered your question!
这篇关于Facebook SDK iOS:添加帖子以供图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文