问题
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