当我尝试使用 Twitter 登录时,我的应用程序崩溃并显示错误消息
在应用程序设置中未设置有效的 Twitter Kit URL 方案的情况下尝试登录或点赞推文。请参见https://dev.twitter.com/twitterkit/ios/installation https://dev.twitter.com/twitterkit/ios/installation了解更多信息。
我已经使用 Fabric 应用了 twitter 登录。但是在将我的代码从 swift 2.3 转换为 swift 3 后,它开始崩溃。我也更新了我的 pod,并重新应用了在没有 Fabric 的情况下再次登录的步骤,因为 Fabric 现在不显示 twitter 选项。但崩溃仍然存在。
如果我理解正确的话,你已经将 Twitter 与 Fabric 一起使用了,所以我假设你的 AppDelegate 中有类似这样的东西:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
Fabric.with([Twitter.self])
return true
}
请注意,由于 Google 收购了 Fabric,您应该使用:
Twitter.sharedInstance().start(withConsumerKey:"yourAppKey", consumerSecret:"yourAppSecret")
您还应该配置 Info.plist 以包含 TwitterKit 的 URL 方案,如下所示:
- 在 CFBundleURLSchemes 中,您应该有带有此值的字符串键
“twitterkit-yourAppKey”
- 在 LSApplicationQueriesSchemes 中,您
应该添加那些“twitter”和“twitterauth”
以供参考:https://dev.twitter.com/twitterkit/ios/installation https://dev.twitter.com/twitterkit/ios/installation
PS:确保 CFBundleURLSchemes 中的“twitterkit-yourAppKey”是第 0 项,当前版本(3.0.3)中有一些奇怪的错误,如果它不是第一个项目,它就会崩溃。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)