Facebook上的图片发布?

时间:2012-08-03 13:59:36

标签: iphone ios facebook

在我的申请中。我在Facebook墙上成功发布了一张图片(图片类型为JPEG Type)。它在Simulator和Device中工作正常。

但问题是,当我从iPhone上捕获图像或从相机捕获的库中选择图像时。它不是张贴在Facebook Wall上。

另一方面,当我从我的iPhone库中选择任何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];


}

1 个答案:

答案 0 :(得分:0)

我的猜测是你在错误的属性中传递图像:

NSMutableDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:
                    sobj.imgFinalImage, @"picture",
                    Message, @"caption",
                     nil];

[[appDelegate facebook] requestWithMethodName:@"photos.upload"
                   andParams:params
                   andHttpMethod:@"POST"
                  andDelegate:self];

然后确保实施Facbook请求的委托以检查图像是否已上传。

使用图表API,您无法直接发送UIImage,您需要发送NSData的{​​{1}}代表:

UIImage