简体   繁体   English

如何在不使用第三方库的情况下在Facebook上共享链接?

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

相关问题 如何在不使用ios中使用第三方文件的情况下获得类似于滑动菜单的Facebook? - How to get facebook like sliding menu without using third party files in ios? 如何在没有任何第三方库的情况下在Swift 3.0中使用Alamofire解析JSON - How to parse JSON using Alamofire in Swift 3.0 without any third-party library 如何在 iOS 应用程序中使用 GIF,而不使用 UIKit 在 Swift 5 中的任何第三方库? - How to use GIFs inside an iOS App without any Third Party Library in Swift 5 using UIKit? 如何在没有第三方库的情况下创建自定义幻灯片菜单? - How to create custom slide menu without third party library.? 使用VS2012和Build Host时如何从Xamarin.iOS中的类库链接第三方dll - How to link third party dll from class library in Xamarin.iOS when using VS2012 and Build Host 如何使用FBSDKShareLink在Facebook上共享链接? - How to Share Link on Facebook using FBSDKShareLink? 如何在不使用第三方库的情况下在 swift2 中下载页面? - How to download a page in swift2 without using third party libraries? 如何在不使用本机ios应用程序的FBSDKShareDialog的情况下在Facebook墙上共享照片或链接 - how to share a Photo Or link on facebook wall without using FBSDKShareDialog from native ios app 使用第三方库的更简洁的方法 - Cleaner approach of using third party library 如何在iOS中正确链接第三方库 - How to link third party libraries properly in iOS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM