如何将图像发布到Facebook墙?

时间:2012-07-14 10:07:47

标签: iphone ios xcode fb-graph

使用这个Tutorail我熟练地登录Facebook http://www.raywenderlich.com/1626/how-to-post-to-a-users-wall-upload-photos-and-add-a-like-button-from-your-iphone-app 但我没有facebook for facebook的经验。

- (IBAction)rateTapped:(id)sender {
     NSURL *url = [NSURL URLWithString:@"YOur Image url"];
     NSData *data = [NSData dataWithContentsOfURL:url];
     UIImage *img  = [[UIImage alloc] initWithData:data];
     [variables setObject:img forKey:@"picture"];
     FbGraphResponse *fb_graph_response = [fbGraph doGraphPost:@"/me/photos" 
    withPostVars:variables];    
  }

但在这里我很困惑,我们如何传递图像网址,bcz我的图像在同一页面上当我使用这个代码时,它给了我以下四个错误。

enter image description here

我没有运气。怎么了?提前致谢

2 个答案:

答案 0 :(得分:2)

请参阅此帖子 - How to share or post by mail, twitter and facebook from the current application? 在此,您将找到如何将UIImage分享到 Facebook Twitter 电子邮件

答案 1 :(得分:0)

第一个错误是由于* 未声明的变量 * 您未将Facebook sdk 添加到您的项目中,这就是您获得 2,3&第4次错误。 要在您的应用程序中使用Facebook功能,您需要将Facebook API集成到您的项目中。 最新的面部书API称为Graph API。 如需进一步参考,请访问http://developers.facebook.com/docs/reference/api/

如何将Facebook sdk集成到您的项目中: http://www.raywenderlich.com/77/how-to-post-on-facebook-with-your-iphone-app