使用oAuth错误进行Twitter集成

使用oAuth错误进行Twitter集成,twitter,oauth,integration,titanium,nsexception,Twitter,Oauth,Integration,Titanium,Nsexception,你好 我试图从我的应用程序中发布一条tweet。当我按下“post tweet”按钮时,身份验证窗口(twitter登录窗口)打开,但当它加载时,我的应用程序就退出了 日志中出现以下错误: [ERROR] Error Domain=com.google.GDataXML Code=-1 "The operation couldn’t be completed. (com.google.GDataXML error -1.)". in -[TiDOMDocumentProxy parseStrin

你好 我试图从我的应用程序中发布一条tweet。当我按下“post tweet”按钮时,身份验证窗口(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);
    }
找到了答案

线路

 oAuthAdapter.showAuthorizeUI('https://api.twitter.com/oauth/authorize'
应该是

 oAuthAdapter.showAuthorizeUI('https://api.twitter.com/oauth/authorize?'

使用此代码而不是上面两行showAuthorization和getRequestToken

oAuthAdapter.showAuthorizeUI('https://twitter.com/oauth/authorize?oauth_token=' +
oAuthAdapter.getRequestToken('https://twitter.com/oauth/request_token', 
[['oauth_callback', 'oob']]), receivePin, PinFinder.twitter);

欢迎来到SO!很高兴听到它被分类了。您可以通过单击此答案上向上/向下箭头旁边的空心复选标记来接受自己的答案。如果有机会,请抓住机会阅读常见问题解答@。