尝试在 Twitter 上分享状态更新。我相信我已经完成了所有的握手工作,但是当我打电话更新状态时出现错误。
这是我的代码
var params:Object = {};
params.status = message;
var consumer:OAuthConsumer = new OAuthConsumer(TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET);
var token:OAuthToken = new OAuthToken(twitterAccessObj.accessKey, twitterAccessObj.accessSecret);
var postRequest:OAuthRequest = new OAuthRequest(OAuthRequest.HTTP_MEHTOD_POST, "https://api.twitter.com/1.1/statuses/update.json", {status:message}, consumer, token);
var urlRequest:URLRequest = new URLRequest(postRequest.buildRequest(new OAuthSignatureMethod_HMAC_SHA1()));
urlRequest.method = URLRequestMethod.POST;
urlRequest.url = urlRequest.url.replace("&status=" + URLEncoding.encode(params.status), "");
urlRequest.data = new URLVariables("status="+message);
var loader:URLLoader = new URLLoader(urlRequest);
loader.addEventListener(Event.COMPLETE, onTwitterPostComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, onTwitterIOError);
loader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onTwitterHttpStatus);
我最终得到一个 IOError-2032,我认为这意味着我的 URL 不正确。有人可以帮我吗?
URL的跟踪是:
https://api.twitter.com/1.1/statuses/update.json?oauth_consumer_key=KEY&oauth_nonce=NONCE&oauth_signature=SIGNATURE&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1375370282&oauth_token=TOKEN
干杯。