2011-03-10 6 views
0

안녕하세요 내 응용 프로그램에서 트윗을 게시하려고했습니다. "post tweet"버튼을 누르면 인증 윈도우 (트위터에 의한 로그인 윈도우)가 열리지 만,로드되면 내 어플리케이션이 종료됩니다.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); 
    } 

답변

1

.

라인

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

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

에 오신 것을 환영합니다 SO해야합니다! 듣기 좋게 분류됩니다. 이 대답의 위쪽/아래쪽 화살표 옆에있는 짙은 체크 표시를 클릭하여 자신의 대답을 수락 할 수 있습니다. 기회가 생기면 FAQ @ http://stackoverflow.com/faq를 읽어보십시오. –

0

사용이 코드 대신 위의 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);