如何将图像分享到Facebook?

如何将图像从iPhone应用程序共享到Facebook?

我非常感谢任何指导或帮助。

有关如何使用新的Facebook图形API的Ray Wenderlech教程。

http://www.raywenderlich.com/1488/how-to-use-facebooks-new-graph-api-from-your-iphone-app

现在,一旦你让用户给你持久性,在你的情况下它将是publish_stream。 您可以使用参数调用图形API以在墙上发布照片。

您需要深入了解开发人员帮助指南,以准确找到符合您要求的Graph api。 然后,您必须使用从第一步获得的accesstoken来进行后续调用。

您始终必须首先打开Facebook应用程序(如果未安装应用程序,则使用WebView)以获取登录令牌。 尝试使用BMSocialShare ,这是我写的一个简单的lib。 它可以帮助您将图像和普通post分享到Facebook,Twitter或电子邮件。 它让你上传一些本地图像(甚至打开用户添加评论的对话框)到用户的墙上:

 BMFacebookPost *post = [[BMFacebookPost alloc] initWithImage:[UIImage imageNamed:@"image.png"]]; [[BMSocialShare sharedInstance] facebookPublish:post]; 

或者做一些更强化的事情:

 BMFacebookPost *post = [[BMFacebookPost alloc] initWithTitle:@"Simple sharing via Facebook, Email and Twitter for iOS!" descriptionText:@"Posting to Facebook, Twitter and Email made dead simple on iOS. Simply include BMSocialShare as a framework and you are ready to go." andHref:@"https://github.com/blockhaus/BMSocialShare"]; [post setImageUrl:@"http://www.blockhausmedien.at/images/logo-new.gif" withHref:@"http://www.blockhaus-media.com"]; [post addPropertyWithTitle:@"Download" descriptionText:@"github.com/blockhaus/BMSocialShare" andHref:@"http://github.com/blockhaus/BMSocialShare"]; [post addPropertyWithTitle:@"Developed by" descriptionText:@"blockhaus" andHref:@"http://www.blockhaus-media.com"]; [[BMSocialShare sharedInstance] facebookPublish:post]; 

首先,您需要获得publish_stream的权限,否则照片共享将不会自动显示在墙上或相册中

有关详细信息,请参阅

http://chings228.wordpress.com/2012/04/06/facebook-ios-login-part-3/