ios - 没有可用应用程序时在浏览器中登录 Twitter

标签 ios objective-c twitter twitter-oauth

我正在构建一个示例以通过 Twitter 进行身份验证,我将文档扔到这里:http://docs.fabric.io/ios/twitter/authentication.html

实现登录按钮后,它只访问手机中的帐户,如果没有帐户,它就不会转到浏览器并登录。如 Facebook 或 Google+。

这是我在 viewDidLoad 中的内容:

TWTRLogInButton* logInButton = [TWTRLogInButton buttonWithLogInCompletion:^(TWTRSession* session, NSError* error) {
    if (session) {
        self.userName.text = [NSString stringWithFormat:@"%@",[session userName]];
        self.UserID.text = [NSString stringWithFormat:@"%@",[session userID]];
    } else {
        NSLog(@"error: %@", [error localizedDescription]);
    }
}];
logInButton.center = CGPointMake(190.0, 250.0);
[self.view addSubview:logInButton];


[[Twitter sharedInstance] logInWithCompletion:^(TWTRSession *session, NSError *error) {
    if (session) {
        self.userName.text = [NSString stringWithFormat:@"%@",[session userName]];
        self.UserID.text = [NSString stringWithFormat:@"%@",[session userID]];
    } else {
        NSLog(@"error: %@", [error localizedDescription]);
    }
}];

AppDelegate 中:

[[Twitter sharedInstance] startWithConsumerKey:@"something" consumerSecret:@"another thing"];
[Fabric with:@[[Twitter sharedInstance]]];

如何允许使用浏览器登录?

最佳答案

我在“设置”选项卡下的 Twitter 应用程序管理中添加了一个回调 URL,然后它在不删除任何内容的情况下工作。

关于ios - 没有可用应用程序时在浏览器中登录 Twitter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31400820/

相关文章:

jquery - 使用 jQuery 滚动 Twitter 提要

ios - 编写 UIView 层次结构

iphone - 修改动态 ScrollView 项

ios - GPUImageStillCamera 不工作

objective-c - 奇怪的情况后 iPodMusicPlayer 播放状态不准确

javascript - Puppeteer:向下滚动 Twitter 时间轴停止

javascript - 如何在 Android 中突破 Twitter 应用内浏览器?

ios - 无需开发帐户即可从 Xcode 部署应用程序

html - 如何从 iOS UILabel 对象中的 NSAttributedString(从 HTML 转换而来)中消除多余的换行符?

ios - iOS8 在搜索栏中输入文本时出现错误