iOS follow button




I need to implement follow button in my iOS app, is there a way to do it?

I found a way for websites but I need for iOS app.

Any suggestions?



Hey @mariamAbdulrahm,

There isn’t a built in way into Twitter Kit, but you can construct the request using the REST API:


Hey @bonnell,

Thanks for your help. This is my code:

        let client = TWTRAPIClient()
        var clientError : NSError?
        let statusesShowEndpoint = ""

        let request = client.URLRequestWithMethod("POST", URL: statusesShowEndpoint, parameters: nil, error: &clientError)
        client.sendTwitterRequest(request) { (response, data, connectionError) -> Void in
            if connectionError != nil {
                print("Error: \(connectionError)")
            guard let myData = data else {
                print("error nil")
            let json = JSON(data: myData)

I got this error:

Error: Optional(Error Domain=TwitterAPIErrorDomain Code=220 "Request failed: forbidden (403)" UserInfo={NSLocalizedFailureReason=Twitter API error : Your credentials do not allow access to this resource. (code 220), TWTRNetworkingStatusCode=403, NSErrorFailingURLKey=, NSLocalizedDescription=Request failed: forbidden (403)})

Any suggestions?


Your TWTRAPIClient will need to be authenticated at some point - have you implemented Sign in with Twitter in your app as well?


@andypiper Hey, Thanks for your reply. Yes I implemented it as follow:

let logInButton = TWTRLogInButton { (session, error) in
            if let unwrappedSession = session {
                self.userName.setValue(unwrappedSession.userName, forKey: "userName")
                let alert = UIAlertController(title: "Logged In",
                    message: "User \(unwrappedSession.userName) has logged in",
                    preferredStyle: UIAlertControllerStyle.Alert
                alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
                self.presentViewController(alert, animated: true, completion: {
                    self.performSegueWithIdentifier("toMainPage", sender: nil)
            } else {
                NSLog("Login error: %@", error!.localizedDescription);