图片在Facebook上发布?

在我的应用程序。 我成功地在我的Facebook墙上张贴图像(图像typesJPEGtypes)。 在Simulator和Device中也可以正常工作。

但问题是,当我从我的iPhone拍摄图像或从相机捕获的库中select一个图像。 这不是发布在Facebook墙上。

另一方面,当我从我的iPhone库select任何JPEG图像(通过互联网下载)。 它张贴在墙上。

在我看来有图像格式问题。 请指导我

谢谢

我的代码在这里。

-(IBAction)clickButtonClicked { // For link post NSString *Message = [NSString stringWithFormat:@"Testing Iphone App : \"http://www.google.com\" "]; DataClass *obj=[DataClass getInstance]; UIImage *image=[[UIImage alloc]init ]; image= obj.imgFinalImage; NSMutableDictionary *params1 = [[NSMutableDictionary alloc]init]; [params1 setObject:image forKey:@"source"]; [params1 setObject:Message forKey:@"message"]; NSString *post=@"/me/photos"; [[appDelegate facebook] requestWithGraphPath:post andParams:params1 andHttpMethod:@"POST" andDelegate:self]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Message!" message:@"Invitation Send Sucessfully" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alert show]; [alert release]; } 

我的猜测是,你通过错误的属性的形象:

 NSMutableDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: sobj.imgFinalImage, @"picture", Message, @"caption", nil]; [[appDelegate facebook] requestWithMethodName:@"photos.upload" andParams:params andHttpMethod:@"POST" andDelegate:self]; 

然后确保您执行Facbook请求的委托来检查图像是否上传。

使用graphicsAPI你不能直接发送UIImage ,你需要发送UIImageNSData表示:

 NSMutableDictionary *params1 = [[NSMutableDictionary alloc]init]; NSData *imageDate = UIImagePNGRepresentation(obj.imgFinalImage); [params1 imageDate forKey:@"source"]; [params1 setObject:Message forKey:@"message"]; NSString *post=@"/me/photos"; [[appDelegate facebook] requestWithGraphPath:post andParams:params1 andHttpMethod:@"POST" andDelegate:self];