OGeek|极客世界-中国程序员成长平台

标题: ios - 没有可用应用程序时在浏览器中登录 Twitter [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 15:50
标题: ios - 没有可用应用程序时在浏览器中登录 Twitter

我正在构建一个样本来通过 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]]];

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



Best Answer-推荐答案


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

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






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4