Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在iphone上共享Facebook上捆绑和链接的图像_Iphone_Ios_Objective C - Fatal编程技术网

在iphone上共享Facebook上捆绑和链接的图像

在iphone上共享Facebook上捆绑和链接的图像,iphone,ios,objective-c,Iphone,Ios,Objective C,我想从我的iphone应用程序共享到Facebook的图像、链接等。我的应用程序链接、阳离子、名称和描述已成功发布。但我不能分享我的形象。请按我的密码 UIImage *image = [UIImage imageNamed:@"sample.png"]; NSData *imgData = UIImageJPEGRepresentation(image, 1.0); self.dictionary =[[NSMutableDictionary alloc] initWithObjectsAn

我想从我的iphone应用程序共享到Facebook的图像、链接等。我的应用程序链接、阳离子、名称和描述已成功发布。但我不能分享我的形象。请按我的密码

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?请帮助我。

使用以下方法:

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];
使用方法如下:

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];

谢谢你的回复。你的代码正在运行。但我需要使用facebook共享“我/订阅”。在这种情况下,我无法将图像共享到FaceBook如果你想共享图像,那么你必须使用我/照片。谢谢你的回复。你的代码正在工作。但我需要使用facebook共享“我/订阅”。在这种情况下,我无法将图像共享到FaceBook如果您想共享图像,则必须使用我/照片。