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

北战南征 提交于 2019-12-11 01:22:33

问题


With TwitterKit 3.3.0 in Swift sharedInstance().sessionStore.session() now returns a TWTRAuthSession rather than a TWTRSession, as before. Things change, that's fine, however the documentation hasn't been updated to reflect this, and as such I no longer know how to access the userName property that the former TWTRSession object offered.


回答1:


You can do this with perform(_:)

Hope below will help those who face this.

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


来源:https://stackoverflow.com/questions/48037798/twtrtwitter-sessionstore-now-returns-twtrauthsession-so-how-does-one-access-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!