How do I store & access a Twitter Fabric login session (iOS/Swift)? -
i'm able log in twitter through app using twitter fabric code:
let loginbutton = twtrloginbutton(logincompletion: { (session: twtrsession!, error: nserror!) in // play twitter session if (session != nil) { println("signed in \(session.username)"); self.twusernamelabel.text = "logged in @" + session.username } else { println("error: \(error.localizeddescription)"); } })
when click login button, prompts me approve login , logs me in, or knows approved login , logs me in. works charm , took of ten minutes set up. amazing.
i have email-based login access app. i'd store user's logged in twitter account in same database, when user logs in email, know twitter (if have logged in before) , don't need log in again. reason email login because twitter important feature in app, not total requirement.
the issue have no idea how access session
outside of when button clicked , logincompletion
fires, , don't know variables store upon initial login/check upon using app.
i've read through twitter fabric documentation numerous times, isn't written in swift, it's pretty confusing. ideas? thanks
if there active session should able access docs to
twitter.sharedinstance().session()
if user isn't logged in method return nil. if want know if authenticated check see if method returns value or not.