xcode 在 iOS 应用程序中创建共享按钮(推特 facebook...)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9293112/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 23:18:51  来源:igfitidea点击:

Creating share buttons in iOS app ( twitter facebook...)

iosxcodefacebooktwitter

提问by Guy Daher

I was wondering what is a good way to create share buttons in iOS, and by share buttons I mean these 3 kinds of buttons: 1- Follow me on Twitter 2- Like a page on Facebook 3- Send a mail (Optional) I have heard about sharekit but I am interested in just creating these 3 buttons that will be found on the back of the page of the app.

我想知道在 iOS 中创建共享按钮的好方法是什么,共享按钮是指这 3 种按钮:1- 在 Twitter 上关注我 2- 在 Facebook 上赞一个页面 3- 发送邮件(可选)我有听说过 sharekit,但我对创建这 3 个按钮感兴趣,这些按钮将在应用程序页面的背面找到。

采纳答案by Peter Sarnowski

Posting data to social services is much more complicated than just setting up a button. You must register your application, choose user, authenticate, then communicate via the internet.

将数据发布到社交服务比仅仅设置一个按钮要复杂得多。您必须注册您的应用程序,选择用户,进行身份验证,然后通过互联网进行通信。

ShareKit does most of that for you.

ShareKit 为您完成了大部分工作。

You may not just 'create share button' and have it share data to fb or twitter.

您可能不只是“创建共享按钮”并让它将数据共享到 fb 或 twitter。

回答by Stefan K.

You can use something like:

你可以使用类似的东西:

NSString *launchUrl = @"http://twitter.com/intent/user?screen_name=USER NAME";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: launchUrl]];

which will open Mobile Safari and let you follow that user. You may be required to log in. I guess there is a similar URL for Facebook.

这将打开 Mobile Safari 并让您关注该用户。您可能需要登录。我想 Facebook 有一个类似的 URL。

To send a mail from within your app, use the MessageUI Framework.

要从您的应用程序内发送邮件,请使用MessageUI 框架

回答by Isaac A Mosquera

Posting to those service is complicated because you'll have to create Apps on those social networks as well as handle the oauth handshake the occurs which allows your app to share on behalf of the user. The Socialize SDK (www.getsocialize.com) is the fastest way to get Facebook/Twitter authentication without coding it yourself. Sample code below:

发布到这些服务很复杂,因为您必须在这些社交网络上创建应用程序并处理发生的 oauth 握手,这允许您的应用程序代表用户进行共享。Socialize SDK (www.getsocialize.com) 是无需自己编码即可获得 Facebook/Twitter 身份验证的最快方法。示例代码如下:

Socialize* socialize = [[Socialize alloc] initWithDelegate:self];
[self.socialize createShareForEntityWithKey:@"http://www.url.com" medium:SocializeShareMediumFacebook text:@"Check this out!"];

回答by aumanets

You could use ShareKit 2.0 https://github.com/ShareKit/ShareKit

您可以使用 ShareKit 2.0 https://github.com/ShareKit/ShareKit

I believe it supports sharing on most common social networks.

我相信它支持在最常见的社交网络上共享。