简体   繁体   English

在iOS应用中创建共享按钮(Twitter Facebook…)

[英]Creating share buttons in iOS app ( twitter facebook…)

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

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. 这将打开Mobile Safari,并让您关注该用户。 You may be required to log in. I guess there is a similar URL for Facebook. 您可能需要登录。我猜Facebook也有一个相似的URL。

To send a mail from within your app, use the MessageUI Framework . 要从您的应用程序内发送邮件,请使用MessageUI Framework

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. 发布到这些服务很复杂,因为您必须在这些社交网络上创建应用程序并处理发生的oauth握手,这使您的应用程序可以代表用户共享。 The Socialize SDK (www.getsocialize.com) is the fastest way to get Facebook/Twitter authentication without coding it yourself. Socialize SDK(www.getsocialize.com)是获得Facebook / Twitter身份验证而无需自己编写代码的最快方法。 Sample code below: 下面的示例代码:

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

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. 我相信它支持大多数常见社交网络上的共享。

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. 您必须注册您的应用程序,选择用户,进行身份验证,然后通过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。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM