TwitterKit 3.3.0的TWTRSession问题

时间:2018-01-17 08:42:15

标签: ios swift twitterkit

let sessions = TWTRTwitter.sharedInstance().sessionStore.existingUserSessions()

应该返回一个TWTRSession的数组。 但是元素的类型是无类型的(Any),并且使用if let authsession = any as? TWTRSession转换为TWTRSession失败。此外,强制铸造明显崩溃。

let authsession = any as! TWTRSession // crashes

崩溃错误:

Could not cast value of type 'TWTRSession' (0x103fbe370) to 'TWTRSession' (0x103cf5cc8).

这是一个非常有趣的错误,你不觉得吗? TWTRSession匹配,但当然,十六进制值不匹配。

哦,这一直到3.3.0之前。 Twitter上的人没有发布说明或迁移说明。事情只是默默地停止了工作。

相关:TWTRTwitter sessionStore now returns TWTRAuthSession: so how does one access the userName property now?

1 个答案:

答案 0 :(得分:0)

我最终创建了一个C函数来重新创建数组并从我的Swift文件中调用它:

IFS