Iphone 将UIImage与其他文本一起发布到facebook
我正试图使用以下代码在facebook上发布一张图片Iphone 将UIImage与其他文本一起发布到facebook,iphone,facebook,Iphone,Facebook,我正试图使用以下代码在facebook上发布一张图片 FBStreamDialog* dialog ; if([FBSession session].isConnected) dialog = [[[FBStreamDialog alloc] initWithSession:[FBSession session]] autorelease]; else dialog = [[[FBStreamDialog allo
FBStreamDialog* dialog ;
if([FBSession session].isConnected)
dialog = [[[FBStreamDialog alloc] initWithSession:[FBSession session]] autorelease];
else
dialog = [[[FBStreamDialog alloc] initWithSession:session] autorelease];
dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"%@\",\"media\":[{\"type\":\"image\",\"src\":\"%@\"}]}", strEventStatus,eventImg];
[dialog show];
除了src之外,媒体标签是否还有任何其他属性可以以NSData的形式获取和映像?否则我如何发布图像?我不知道您正在使用的Facebook API,但图像SRC似乎暗示图像已经存在于web上的某个地方 您是否考虑过将图像上传到某个服务器并使用图像的SRC作为URL
我希望这有帮助 链接图像的附件属性时,源应该是URL。。我不认为你可以使用附件发布UIImage。。一种解决方案是,您可以使用一个Web服务在服务器中发布图像,然后在发布时提供该URL 我不知道你在使用哪个Facebook API。。 这就是我使用Facebook Graph API上传图像时所做的
UIImage *img = [UIImage imageNamed:@"myImage.png"];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
img, @"picture",
nil];
//facebook is a facebook Obj which I initialized before
[facebook requestWithMethodName:@"photos.upload"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
您可以直接获取
UIimage
并通过buildsuccessed
使用的代码上传,您不再需要将图像转发到服务器并通过URL链接。您还可以从UIimageview
、相机或库调用图像