繁体   English   中英

未安装应用程序时的iOS Twitter登录

[英]iOS twitter login when app is not installed

在我的iOS应用中,我正在使用TwitterKit

我面临的问题是,当未安装Twitter应用程序时,无法登录用户

我看到了建议添加任何回调URL的答案,但此方法不再起作用

我尝试了两件事:在他们的文档中搜索,什么也没找到。 尝试此答案当未在iOS 11中安装Twitter应用程序时,使用Twitterkit进行鸣叫失败 该解决方案不再起作用

谢谢你的帮助!

以这种格式添加回调URL

twitter-twitterid://

(用“您的Twitter应用程序ID”替换“ twitterid”)

经过大量的研发,我获得了成功。 Twitter已强制要求回调网址。 我从这个连结找到

您需要在Twitter仪表板设置的回调URL中添加twitterkit-123456478:// (twitterkit-consumerKey)。

我使用这种方法打开safari(确保您添加了safari框架)

TWTRTwitter.sharedInstance().logIn(with: self) { (session, error) in
            if (session != nil) {
                print("signed in as \(session?.userName ?? "")");
            } else {
                print("error: \(error?.localizedDescription ?? "")");
            }
        }

代理

 func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
           if url.scheme?.caseInsensitiveCompare(("twitterkit-" + TwitterKey.consumerKey)) == .orderedSame{
                TWTRTwitter.sharedInstance().application(app, open: url, options: options)
            }
            return true
        }

暂无
暂无

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

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