如何将照片发布到 facebook iphone fbconnect

发布于 2024-11-28 06:52:26 字数 1194 浏览 1 评论 0原文

您好,我正在使用 FBConnect 发布到 Facebook,现在我需要发布库中的照片或用相机拍摄的照片,有人知道如何执行此操作吗?我在谷歌中搜索过,但找不到适合我的代码。我找到了这种方法:

FBRequest *uploadPhotoRequest = [FBRequest requestWithDelegate:self];
     [uploadPhotoRequest call:@"photos.upload" params:args];

但在我的 fbconnect 中我有这个:(我认为 api 的版本不同)

 [_fbRequest call:(NSString *) params:(NSDictionary *) dataParam:(NSData *)];

另外,我正在使用这种方法发布到墙上:

 - (void)postToWall {       FBStreamDialog* dialog = [[[FBStreamDialog
 alloc] init] autorelease];
 dialog.userMessagePrompt = @"Enter your message:";   
 dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"%@ Esta conectado desde TravelFan iPhone App\",\"caption\":\"Viajar te cambia la vida\",\"description\":\"\",\"media\":[{\"type\":\"image\",\"src\":\"http://www.travelfan.com.mx/content/templates/default/images/logo_travel.jpg\",\"href\":\"http://www.travelfan.com.mx/\"}]}",
 _facebookName];   
dialog.actionLinks = @"[{\"text\":\"Obten TravelFan
 App!\",\"href\":\"http://www.travelfan.com.mx/\"}]";   [dialog show];  
 }

在这种方法中,我可以发送图像,但是不是照片,它只是用于应用程序徽标及其附件。

谁能告诉我如何将照片贴到墙上吗? 如有任何帮助,我们将不胜感激。XD。

Hi I'm using FBConnect to post to facebook, now I need to post photos from library or taken with the cam, does anyone has a clue how to do this ?? I've searched in google but I can't find a piece of code that works for me. I've found this method:

FBRequest *uploadPhotoRequest = [FBRequest requestWithDelegate:self];
     [uploadPhotoRequest call:@"photos.upload" params:args];

but in my fbconnect i have this one instead: (I think the version of the api is different)

 [_fbRequest call:(NSString *) params:(NSDictionary *) dataParam:(NSData *)];

Also I'm using this method to post to the wall:

 - (void)postToWall {       FBStreamDialog* dialog = [[[FBStreamDialog
 alloc] init] autorelease];
 dialog.userMessagePrompt = @"Enter your message:";   
 dialog.attachment = [NSString stringWithFormat:@"{\"name\":\"%@ Esta conectado desde TravelFan iPhone App\",\"caption\":\"Viajar te cambia la vida\",\"description\":\"\",\"media\":[{\"type\":\"image\",\"src\":\"http://www.travelfan.com.mx/content/templates/default/images/logo_travel.jpg\",\"href\":\"http://www.travelfan.com.mx/\"}]}",
 _facebookName];   
dialog.actionLinks = @"[{\"text\":\"Obten TravelFan
 App!\",\"href\":\"http://www.travelfan.com.mx/\"}]";   [dialog show];  
 }

In this method I can send an image but not as a photo its just for the app logo and its an attachment.

Can anyone tell how to post photos to the wall pls ??
Any help is apreciated XD.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浪荡不羁 2024-12-05 06:52:26

您现在可以使用 requestWithGraphPath 方法将照片发布到墙上,如下所示。

NSData *yourImageData= UIImagePNGRepresentation(yourImage);

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               @"Your text with picture", @"message", yourImageData, @"source", nil];

[facebook requestWithGraphPath:@"/me/photos" andParams:params andHttpMethod:@"POST" andDelegate:self];

You can now post photos on your wall with requestWithGraphPath method as follows.

NSData *yourImageData= UIImagePNGRepresentation(yourImage);

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               @"Your text with picture", @"message", yourImageData, @"source", nil];

[facebook requestWithGraphPath:@"/me/photos" andParams:params andHttpMethod:@"POST" andDelegate:self];
嘿哥们儿 2024-12-05 06:52:26

requestWithGraphPath 方法是非阻塞的 - 这意味着它将在照片实际上传之前完成。通过在 FBRequestDelegate 中实现以下内容,您将知道照片何时完成上传

The requestWithGraphPath method is non-blocking - meaning it will complete before the photo is actually uploaded. You'll know when the photo is finished uploading by implementing the following in your FBRequestDelegate

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文