Manually Create Twitter Requests



The Fabric Docs show a way to manually create twitter requests here:
but when I attempt to use this method in my app using Swift, I have multiple errors appear.

I know these all have to do with updated versions of Error Handling, but does anyone have the updated syntax in Swift to manually create these Twitter Get Requests using Fabric.



Hey @DaveMacG

Thanks for reporting this and here’s an updated sample. The public docs will also be updated with the correct code shortly.

// Swift
let client = TWTRAPIClient()
let statusesShowEndpoint = ""
let params = ["id": "20"]
var clientError : NSError?

let request = client.URLRequestWithMethod("GET", URL: statusesShowEndpoint, parameters: params, error: &clientError)

client.sendTwitterRequest(request) { (response, data, connectionError) -> Void in
    if connectionError != nil {
        print("Error: \(connectionError)")

    do {
        let json = try NSJSONSerialization.JSONObjectWithData(data!, options: [])
        print("json: \(json)")
    } catch let jsonError as NSError {
        print("json error: \(jsonError.localizedDescription)")


Thanks for looking into this so quickly.

When I plug that new code in, I still receive an error:

If I delete that “extra argument”, a new/the same error from my first post appears “Call can throw, but it is not marked with ‘try’ and the error is not handled”.

Please assist. Thanks in advance.


Hmm, that’s a bit odd then. Which version of Twitter Kit are you using?


I actually was just manipulating and editing the Twitter Kit Sample provided in the documentation. I downloaded the zip from:


Ahh, that is a bit out of date, sorry about that. To get the latest, head here for instructions to get the code via Cocoapods or through


that worked, thanks @bonnell