[英]how to share a link on facebook without using third party library?
i have doubt to implement share link on facebook and twitter. 我怀疑在Facebook和Twitter上实现共享链接。 actually i implemented social share link using sharekit and addThis third party library it working fine but i want share link without using third party library.
实际上,我使用sharekit和addThis第三方库实现了社交共享链接,它工作正常,但我希望共享链接不使用第三方库。
In iOS 6, You can use UIActivityViewController
to share your link to Social services. 在iOS 6中,您可以使用
UIActivityViewController
共享指向社交服务的链接。
Reference: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIActivityViewController_Class/Reference/Reference.html#//apple_ref/occ/cl/UIActivityViewController 参考: http : //developer.apple.com/library/ios/#documentation/UIKit/Reference/UIActivityViewController_Class/Reference/Reference.html#//apple_ref/occ/cl/UIActivityViewController
It is as easy as these few lines: 这几行就这么简单:
NSString *textToShare = @”I just shared this from my App”;
UIImage *imageToShare = [UIImage imageNamed:@"Image.png"];
NSURL *urlToShare = [NSURL URLWithString:@"http://www.mylink.com"];
NSArray *activityItems = @[textToShare, imageToShare, urlToShare];
UIActivityViewController *activityVC = [[UIActivityViewController alloc]initWithActivityItems:activityItems applicationActivities:nil];
[self presentViewController:activityVC animated:TRUE completion:nil];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.