2

I implemented Twitter share button, but there are no column to change Twitter accounts like this picture. And if I logged out from the account, I can't authorize (login) another account. The view to authorize will never appear.

it has Account and Location columns

My app doesn't have the 2 columns ("Account" and "Location"). So I can't change Account except I authorized at first. How can I solve this problem?

(if possible, it's better to be able to authorize accounts when I logout from all accounts after authorized and tweeted once. But I don't know how to do it....)

        let shareImage = UIImage(named:"Twitter_shareImage")
        let tweetDescription:String = "text"
        TWTRTwitter.sharedInstance().sessionStore.saveSessionWithAuthToken(authToken, authTokenSecret: authTokenSecret, completion: { (session, error) -> Void in

        if (TWTRTwitter.sharedInstance().sessionStore.hasLoggedInUsers()) {

            if let session = TWTRTwitter.sharedInstance().sessionStore.session() {

                let composer = TWTRComposer()
                composer.setText("text")
                composer.setImage(shareImage)
                composer.show(from: self.parentViewController()!, completion: nil)

                print(session.userID)

            } else {

                TWTRTwitter.sharedInstance().logIn {
                    (session, error) -> Void in
                    if (session != nil) {
//                        println("signed in as \(session.userName)");
                    } else {
//                        println("error: \(error.localizedDescription)");
                    }
                }

                print("no account")
            }

        } else {
            // Log in, and then check again
            TWTRTwitter.sharedInstance().logIn { session, error in
                if session != nil { // Log in succeeded
                    let composer = TWTRComposer()
                    composer.setText("text")
                    composer.setImage(shareImage)
                    composer.show(from: self.parentViewController()!, completion: nil)
                } else {
                    let alert = UIAlertController(title: "No Twitter Accounts Available", message: "You must log in before presenting a composer.", preferredStyle: .alert)
                    self.parentViewController()?.present(alert, animated: false, completion: nil)
                }
            }
        }
K.K.D
  • 917
  • 1
  • 12
  • 27

0 Answers0