0
你好 我试图从我的应用程序发布推文。当我按下按钮“发布推文”时,身份验证窗口(通过twitter登录窗口)会打开,但当它加载时,我的应用程序就会退出。使用oAuth错误的Twitter集成
日志中发生以下错误;
[ERROR] Error Domain=com.google.GDataXML Code=-1 "The operation couldn’t be completed. (com.google.GDataXML error -1.)". in -[TiDOMDocumentProxy parseString:] (TiDOMDocumentProxy.m:50)
而在最后,它说
terminate called after throwing an instance of 'NSException
我使用的代码是:
var oAuthAdapter = new OAuthAdapter('SECRET KEY', 'KEY', 'HMAC-SHA1');
// load the access token for the service (if previously saved)
oAuthAdapter.loadAccessToken('twitter');
oAuthAdapter.loadAccessToken('twitter');
oAuthAdapter.send('https://api.twitter.com/1/statuses/update.json', [['status', 'Tweet from appcelerator ' + Math.random()]], 'Twitter', 'Published.', 'Not published.');
if (oAuthAdapter.isAuthorized() == false) {
// this function will be called as soon as the application is authorized
var receivePin = function(){
// get the access token with the provided pin/oauth_verifier
oAuthAdapter.getAccessToken('https://api.twitter.com/oauth/access_token');
// save the access token
oAuthAdapter.saveAccessToken('twitter');
};
// show the authorization UI and call back the receive PIN function
oAuthAdapter.showAuthorizeUI('https://api.twitter.com/oauth/authorize' +
oAuthAdapter.getRequestToken('https://api.twitter.com/oauth/request_token'), receivePin);
}
欢迎SO!很高兴听到它被排序。您可以通过点击此答案上的向上/向下箭头旁边的空白复选标记来接受您自己的答案。当您有机会时,请抓住机会阅读FAQ @ http://stackoverflow.com/faq。 – 2011-03-10 23:32:30