【问题标题】:Mysterious TwitterKit crash神秘的 TwitterKit 崩溃
【发布时间】:2017-10-29 11:29:46
【问题描述】:

我在通过 Fabric 使用 TwitterKit 时看到了一个相当神秘的崩溃。

我的应用程序在此行崩溃:

Fabric.with([Crashlytics.self, Twitter.self])

说:

[Fabric] Please upgrade to the latest version of "Twitter"
[Crashlytics] Version 3.8.4 (121)
Calling Twitter.start is not supported.

我按照文档的说明集成了 TwitterKit,将键和 url 方案添加到我的 Info.plist,但我不明白为什么 Twitter 突然崩溃了。

【问题讨论】:

  • 为什么两个安装指南之间存在差异?我不能再通过 Fabric 安装 Twitter 了吗?
  • 在没有 Fabric 的情况下单独安装 twitter,如果您需要 Fabric,请确保您拥有最新版本的 Fabric 并在构建阶段 -> 运行脚本 -> 取消选中“仅在安装时运行脚本”。
  • 这方面有什么更新吗?
  • 是的!我通过结构删除了集成,只是按照 twitter 文档所说的去做,它起作用了。看起来 twitter 工具包不再适用于 fabric

标签: ios twitter twitter-fabric


【解决方案1】:

带有 TwitterKit 3+ 的新工作版本

Fabric.with([Crashlytics.self]) 
Twitter.sharedInstance().start(withConsumerKey: "key", consumerSecret: "secret")

新建 Pod 文件

pod 'Fabric'
pod 'Crashlytics'
pod 'TwitterKit'

旧版本:

Fabric.with([Crashlytics.self, Twitter.self])

【讨论】: