草庐IT

ios - TWTRTwitter sessionStore 现在返回 TWTRAuthSession : so how does one access the userName property now?

coder 2023-09-16 原文

使用 Swift 中的 TwitterKit 3.3.0 sharedInstance().sessionStore.session() 现在返回一个 TWTRAuthSession 而不是 TWTRSession,因为前。事情发生了变化,这很好,但是the documentation尚未更新以反射(reflect)这一点,因此我不再知道如何访问以前的 TWTRSession 对象提供的 userName 属性。

最佳答案

你可以用 perform(_:) 来做到这一点

希望下面的内容能帮助那些面临这个问题的人。

let username = session.perform(#selector(getter: TWTRSession.userName))?.takeRetainedValue() as? String

关于ios - TWTRTwitter sessionStore 现在返回 TWTRAuthSession : so how does one access the userName property now?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48037798/

有关ios - TWTRTwitter sessionStore 现在返回 TWTRAuthSession : so how does one access the userName property now?的更多相关文章

随机推荐