Same results here unfortunately. Just figured I’d help potentially rule out one of the possibilities.
Here’s my code for reference. Again, very similar to yours and I’ve updated to 1.15.1 as well with no success:
Twitter.sharedInstance().logInWithCompletion { (user, error) in
self.uploadMedia()
}
And here’s the start of the uploadMedia function. I’ve previously tried to pass the userID from the user object returned with logInWithCompletion but the code below now uses the userID from the shared session storage.
let client = TWTRAPIClient(userID: Twitter.sharedInstance().sessionStore.session()!.userID)
let endpoint = "https://upload.twitter.com/1.1/media/upload.json"
let mediaParams = ["media_data": SocialShare.sharedInstance.sharedImageData]
let uploadRequest = client.URLRequestWithMethod("POST", URL: endpoint, parameters: mediaParams, error: nil)
client.sendTwitterRequest(uploadRequest) { (response, data, error) -> Void in
Previously, no issues. Now, after I login to Twitter via the presented UIWebView I see login successful and the sheet is dismissed. Shortly thereafter I get the following error logged:
Error Domain=TwitterAPIErrorDomain
Code=32 "Request failed: unauthorized (401)"
UserInfo={
NSLocalizedFailureReason=Twitter API error : Could not authenticate you. (code 32),
NSErrorFailingURLKey=https://upload.twitter.com/1.1/media/upload.json,
NSLocalizedDescription=Request failed: unauthorized (401)
}
I’ve logged the TWTRAPIClient and the user being passed in the request and everything looks correct. I’ve regenerated my application keys from the developer console.