我想从我的iPhone应用程序分享图像,链接等到Facebook.My app链接,阳离子,名称和描述已成功发布。但我无法分享形象。请关注我的代码..
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代码是..
[facebook requestWithGraphPath:@"/me/feed" andParams:dictionary andHttpMethod:@"POST" andDelegate:self];
我的问题是如何从捆绑中获取图片以及如何将所选图像分享到Facebook?请帮助我..
答案 0 :(得分:5)
使用如下:
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];