我正在尝试在我的 ios 应用中实现 twitter 登录.我不想使用社交框架.我已经尝试了所有方法来登录 twitter,但不幸的是这不起作用.主要是我面临其中的回调 url 问题.你能帮我吗.
I am trying to implement twitter login in my ios app. I do not want to use social frame work. I have tried all ways to twitter login but unfortunately this not working. Mainly i am facing the callback url issue in it. Can you please guys help me.
我也试过这个网址
codegerms/login-with-twitter-example-with-ios-tutorial-using-oauth/
但主要是我面临回调问题.任何人都可以请推荐其他插件.
but mainly i am facing the callback issue. Can any one please suggest other plugin.
推荐答案要从 Twitter 获取用户信息,您可以使用 OAuth.io 的 iOS SDK:github/oauth-io/oauth-ios
To get the user's information from Twitter, you can use OAuth.io's iOS SDK: github/oauth-io/oauth-ios
在 oauth.io 上创建帐户并添加 Twitter 作为提供商后,您将能够很容易地获取用户的信息.您只需按照以下步骤操作:
After having created an account on oauth.io, and added Twitter as a provider, you'll be able to get the user's info quite easily. You just need to follow these steps:
通过可可豆荚:
$ pod install "OAuth.io"手动:
只需获取 OAuthiOS.framework 文件 在这里并像安装任何其他框架一样安装它.
Just get the OAuthiOS.framework file here and install it like any other framework.
在您的 ViewController 中添加 #import .
Add #import <OAuthiOS/OAuthiOS.h> in your ViewController.
@interface MyViewController : UIViewController<OAuthIODelegate> //[...] @end4 在 ViewController 中初始化并启动身份验证弹出窗口:
4 Initialize and launch an authentication popup in the ViewController:
OAuthIOModal *oauthioModal = [[OAuthIOModal alloc] initWithKey:@"your_app_public_key" delegate:self]; [oauthioModal showWithProvider:@"twitter"];5 实现以下委托方法来获取请求对象,这让您可以检索用户的信息,感谢 me 方法:
5 Implement the following delegate method to get a Request Object, that lets you retrieve the user's information, thanks to the me method:
- (void)didReceiveOAuthIOResponse:(OAuthIORequest *)request { [_request me:nil success:^(NSDictionary *output, NSString *body, NSHTTPURLResponse *httpResponse) { NSLog(@"name: %@", [output objectForKey:@"name"]); }]; }要获取有关 iOS SDK 的更多信息,请随时查看此处的指南:
To get more information about the iOS SDK, feel free to check out the guide here:
oauth.io/getting-started?ios&None
您也可以在此处遵循基于 git 的教程:
You can also follow a git based tutorial here:
oauth.io/docs/tutorials/client/ios
并在此处找到 SDK 的参考文档:
And find the reference documentation of the SDK here:
oauth.io/docs/api-reference/client/ios
请注意,OAuth.io 还在 oauthd 项目中开源了它们的核心(查看这里的 repo:github/oauth-io/oauthd)
Note that OAuth.io also open sourced their core in the oauthd project (check out the repo here: github/oauth-io/oauthd)
希望这有帮助:)
更多推荐
没有社交框架的 Twitter 登录
发布评论