[英]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.