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.
Asked
Active
Viewed 281 times
2

Joseph Beuys' Mum
- 2,395
- 2
- 24
- 50
-
Me too. This is really weird, at runtiem it looks like it still returns the old TWTRSession type. But any cast etc fails. TwitterKit has some quality problems... I guess I have to roll back to the previous version after all... – Jonny Jan 17 '18 at 08:41
-
And btw, if I print out the `[Any]` array, it actually still holds the usernames and session cookies: ISSUE1084 sessions as [Any]: [
mynameblbla - 832523035788173312] – Jonny Jan 17 '18 at 08:45 -
@Jonny I like the idea of "runtiem". It sounds like some Vietnamese dish made of leftovers. – Joseph Beuys' Mum Jan 17 '18 at 09:17
-
Culinary issues aside, the username data still exists in the back, but somehow the Vietnamese has managed to hide it from us. – Jonny Jan 17 '18 at 10:56
1 Answers
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

taka
- 1,407
- 5
- 7
-
Thanks for taking the time to answer @taka, I am so far away from this project now that I will be unable to verify your answer or not – Joseph Beuys' Mum Jan 27 '19 at 12:46