简体   繁体   English

如何使用ios 6.0中的社交框架从iphone应用程序在Facebook上分享图像?

[英]How can share images on facebook from an iphone app using social framework in ios 6.0?

I used the code given below. 我使用下面给出的代码。 But it only post image to facebook. 但它只发布图像到Facebook。

UIImage *image = [UIImage imageNamed:@"testimage.png"];
    NSString *caption = @"Gud Mng";
    NSArray *activityItems = @[image, caption];
    // Initialize Activity View Controller
    UIActivityViewController *vc = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
    // Present Activity View Controller
    [self presentViewController:vc animated:YES completion:nil];

Add social framework. 添加社交框架。 Import in your view controller. 在视图控制器中导入。

SLComposeViewController *socialVc=[SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
NSData *data = UIImageJPEGRepresentation(self.defaultImageView.image, 1.0);
[socialVc addImage:[UIImage imageWithData:data]];


[socialVc setInitialText:[NSString    stringWithFormat:@"%@",self.captionTextFeild.text]];
[socialVc addURL:[NSURL URLWithString:@"via www.coderit.com"]];
[self.navigationController presentViewController:socialVc animated:YES completion:nil];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在iOS社交框架中使用SLRequest获取Facebook的电子邮件参数 - How to get Email param of facebook using SLRequest in iOS Social Framework 如何在Facebook上从iPhone书本应用程序共享所选文本 - How to share selected text from iphone book app on Facebook 如何将标签文本从iPhone应用程序共享到Facebook? - How to share text of a label from iPhone app to facebook? 如何从使用钛金属Appcelerator创建的iPhone应用程序在Facebook上共享视频/音频文件 - How to share video / audio file on facebook from iPhone app created using titanium appcelrator 从iPhone App在Facebook上分享视频 - share video on Facebook from iPhone App 如何在Facebook形式的iPhone应用程序上共享状态 - How to share the status on facebook form iphone app 如何将图像从Facebook帐户导入到我的iPhone应用程序? - how can I import images from facebook account to my iphone app? 从iOS 5 app分享内容到Facebook - Share content to Facebook from iOS 5 app 在未使用ios 6.0的iPhone设备上的Safari浏览器中,Facebook登录是在Facebook本机应用程序中打开的 - Facebook Login is opening in Facebook Native app not in safari browser on iphone device with ios 6.0 Facebook通过ios中的社交框架登录 - Facebook login via social framework in ios
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM