从捆绑中共享图像并在iPhone中的Facebook上链接 [英] Share image from bundle and link on Facebook in iphone
本文介绍了从捆绑中共享图像并在iPhone中的Facebook上链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从我的iPhone应用程序共享图像,链接等到Facebook.我的应用程序的链接,阳离子,名称和描述已成功发布.但是我不能分享图像.请遵循我的代码.
I want to share image,link etc to Facebook from my iphone app.My app Link,cation,name and description posted successfully. But i can't share image. Please follow my code..
UIImage *image = [UIImage imageNamed:@"sample.png"];
NSData *imgData = UIImageJPEGRepresentation(image, 1.0);
self.dictionary =[[NSMutableDictionary alloc] initWithObjectsAndKeys: @"https://www.google.com/ios", @"link",
imgData, @"data",
@"AppName", @"name",
@"Testing", @"caption",
@"say something about this", @"description",
nil];
我的分享Facebook代码是..
my share facebook code is..
[facebook requestWithGraphPath:@"/me/feed" andParams:dictionary andHttpMethod:@"POST" andDelegate:self];
我的问题是如何从捆绑包中获取图像以及如何将所选图像共享到Facebook?请帮帮我.
My problem is how to take image from bundle and how to share selected image to Facebook?Please help me..
推荐答案
用法如下:
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"image1" ofType:@"png"];
NSData *videoData = [NSData dataWithContentsOfFile:filePath];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"My hat image", @"message", data, @"source", nil];
[facebook requestWithGraphPath:@"/me/photos" andParams:params andHttpMethod:@"POST" andDelegate:self];
这篇关于从捆绑中共享图像并在iPhone中的Facebook上链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文