i'm trying publish tweet name of app on user's timeline after authorization. i'm trying this:
let tweet = "this tweet has been sent" let tweetbody = nsstring(format: "status=%@", tweet.stringbyaddingpercentencodingwithallowedcharacters(nscharacterset.urlqueryallowedcharacterset())!) tweetbody.stringbyreplacingoccurrencesofstring("!", withstring: "%21") var url = nsurl(string: "https://api.twitter.com/1.1/statuses/update.json") var tweetrequest = nsmutableurlrequest(url: url!) tweetrequest.httpmethod = "post" tweetrequest.httpbody tweetbody.datausingencoding(nsutf8stringencoding) twitter?.signrequest(tweetrequest) alamofire.request(.post, tweetrequest, encoding: .json).validate().responsejson { response in switch response.result { case .success: if let value = response.result.value { let json = json(value) print(json) } case .failure(let error): print(error) } }
but fails , returns 400. how can fix code , send tweet via parse?
update
may can send tweet alamofire parameters https://api.twitter.com/1.1/statuses/update.json
?
Comments
Post a Comment