在iPhone上分享图像来自捆绑和链接

IKK*_*KKA 1 iphone objective-c ios

我想从我的iPhone应用程序分享图像,链接等到Facebook.My应用程序链接,阳离子,名称和描述成功发布.但我无法分享形象.请关注我的代码..

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];
Run Code Online (Sandbox Code Playgroud)

我的分享Facebook代码是..

[facebook requestWithGraphPath:@"/me/feed" andParams:dictionary andHttpMethod:@"POST" andDelegate:self];
Run Code Online (Sandbox Code Playgroud)

我的问题是如何从捆绑中获取图像以及如何将所选图像分享到Facebook?请帮助我..

Vis*_*hal 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];
Run Code Online (Sandbox Code Playgroud)