Hi people. I stuck with the same problem :
Error Domain=TWTRNetworkingErrorDomain Code=-1011 "Request failed: bad request (400)"
UserInfo={NSLocalizedFailureReason=, TWTRNetworkingStatusCode=400,
NSErrorFailingURLKey=https://upload.twitter.com/1.1/media/upload.json, NSLocalizedDescription=Request failed: bad request (400)}
my code as simple as it can be:
let client = TWTRAPIClient.withCurrentUser()
do {
let movieData = try Data(contentsOf:url)
client.uploadMedia(movieData, contentType: "video/mpeg4-generic", completion: { mediaID, error in
if (error != nil) {
print("Tweet composition cancelled:")
print(error as Any)
} else {
print("Sending tweet!")
print("mediaID: ", mediaID as Any)
}
})
} catch {
return
}
Video taked by iPhone
video duration < 7sec
video size < 8Mb
video dimentions = 1280x720
video bitrate = 900k
video fps = 30 fps
audio = no audio
PS. it loads via media validation tool and inspector
PPS. setting “video/quicktime” - doesnt help