I can log in to Twitter through my application using this Twitter cloth code:
let logInButton = TWTRLogInButton(logInCompletion: { (session: TWTRSession!, error: NSError!) in // play with Twitter session if (session != nil) { println("signed in as \(session.userName)"); self.TWUsernameLabel.text = "Logged in as @" + session.userName } else { println("error: \(error.localizedDescription)"); } })
When I press the login button, I am asked to approve the login, and then enters me into the system, or he knows that I have already approved the login, and he registers me. It works like a charm and takes all ten minutes to set up. Amazing
I already have an email to enter the application. I would like to keep the user registered in the Twitter account in the same database, so when the user logs in with his email, I already know their Twitter (if they logged in earlier), and they do not need to log in again to the system, The reason I am registering by email is that Twitter is an important feature in my application, but not a general requirement.
The problem is that I have no idea how to access session outside of the button click and logInCompletion , and I don’t know which variables to store at the first login / check when using the application.
I've read Twitter documentation many times, but it’s not written fast, so it’s pretty confusing. Any ideas? Thanks
source share