[iOS] 401 unauthorized error when using brackets

ios
twitterkit

#1

This seems to be a different instance of this other thread about square brackets.

I’ve borrowed the example from there:

    Twitter.sharedInstance().startWithConsumerKey("MY_CONSUMER_KEY", consumerSecret: "MY_CONSUMER_SECRET")
    Fabric.with([Crashlytics.self, Twitter.self])
    
    let endpoint = "https://api.twitter.com/1.1/statuses/update.json"
    let parameters = ["status": "I went to {Central Park}"]
    
    let client = Twitter.sharedInstance().APIClient
    let request = client.URLRequestWithMethod("POST", URL: endpoint, parameters: parameters, error: nil)
    client.sendTwitterRequest(request, completion: { (urlResponse, data, connectionError) -> Void in
        print(urlResponse)
        print(data)
        print(connectionError)
    })

I’m getting:

Optional(Error Domain=TwitterAPIErrorDomain Code=32 "Request failed: unauthorized (401)" UserInfo={NSErrorFailingURLKey=https://api.twitter.com/1.1/statuses/update.json, NSLocalizedDescription=Request failed: unauthorized (401), NSLocalizedFailureReason=Twitter API error : Could not authenticate you. (code 32)})

Seems to be exactly the same issue, but with { instead of [.

Is there any workaround I can try until the framework gets fixed?


#2

This does look to be an issue, and we have a fix in the pipeline.

Thanks for the report!