Twitter登录按钮无法登录

时间:2016-03-28 16:25:31

标签: ios twitter

我下载了一些关于twitter登录代码的示例代码并在Xcode中运行,当我运行App时,屏幕上出现一个按钮,当我点击它时,我无法成功登录twitter,代码转到了else路径,与按钮关联的代码如下所示:

@IBAction func signInWithTwitter(sender: UIButton) {
    Twitter.sharedInstance().logInWithCompletion { session, error in
        if session != nil {
            // Navigate to the main app screen to select a theme.
            self.navigateToMainAppScreen()

            // Tie crashes to a Twitter user ID and username in Crashlytics.
            Crashlytics.sharedInstance().setUserIdentifier(session!.userID)
            Crashlytics.sharedInstance().setUserName(session!.userName)

            // Log Answers Custom Event.
            Answers.logLoginWithMethod("Twitter", success: true, customAttributes: ["User ID": session!.userID])
        } else {
            // Log Answers Custom Event.
            Answers.logLoginWithMethod("Twitter", success: false, customAttributes: ["Error": error!.localizedDescription])
        }
    }
}

有没有人遇到这个问题?谁能帮助我,提前谢谢。

0 个答案:

没有答案