gpt4 book ai didi

ios - Twitter 登录因 TWTRInvalidInitializationException 而崩溃

转载 作者:搜寻专家 更新时间:2023-10-31 21:59:08 26 4
gpt4 key购买 nike

当我尝试使用 Twitter 登录时,我的应用程序崩溃,并出现错误消息

尝试在应用程序设置中未设置有效的 Twitter 套件 URL 方案的情况下登录或点赞推文。请看https://dev.twitter.com/twitterkit/ios/installation了解更多信息。

我已经使用 fabric 应用了 Twitter 登录。但是在将我的代码从 swift 2.3 转换为 swift 3 之后,它开始崩溃。我也更新了我的 pod 并重新应用了在没有 fabric 的情况下再次登录的步骤,因为 fabric 没有显示现在推特选项。但崩溃仍然存在。

最佳答案

如果我理解正确的话,你已经将 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 Scheme:

  1. 在 CFBundleURLSchemes 中你应该有这个值的字符串键“twitterkit-你的应用程序 key ”
  2. 在 LSApplicationQueriesSchemes 中你 应该添加那些“twitter”和“twitterauth”

供引用:https://dev.twitter.com/twitterkit/ios/installation

PS:确保您的 CFBundleURLSchemes 中的“twitterkit-yourAppKey”是项目 0,当前版本 (3.0.3) 中存在一些奇怪的错误,如果它不是第一个项目,它会崩溃。

关于ios - Twitter 登录因 TWTRInvalidInitializationException 而崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44427713/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com