2012-02-17 2 views
2

트위터를 보낼 수 있도록 내 코코아 응용 프로그램에 MGTwitterEngine 라이브러리를 사용합니다.MGTwitterEngine을 사용하는 Cocoa 앱을 통한 트위터 : HTTP 오류 401

NSString *username = MyName; 
    NSString *password = MyPass; 

    NSString *consumerKey = ConsumerKey;; 
    NSString *consumerSecret = ConsumerSecret; 

    // Most API calls require a name and password to be set... 
    if (! username || ! password || !consumerKey || !consumerSecret) { 
     NSLog(@"You forgot to specify your username/password/key/secret in AppController.m, things might not work!"); 
     NSLog(@"And if things are mysteriously working without the username/password, it's because NSURLConnection is using a session cookie from another connection."); 
    } 

    // Create a TwitterEngine and set our login details. 
    twitterEngine = [[MGTwitterEngine alloc] initWithDelegate:self]; 
    [twitterEngine setUsesSecureConnection:NO]; 
    [twitterEngine setConsumerKey:consumerKey secret:consumerSecret]; 

    [twitterEngine setUsername:username password:password]; 

    OAToken *token = [[OAToken alloc] initWithKey:tokenKey 
            secret:tokenSecret]; 
    [twitterEngine setAccessToken:token]; 
    [twitterEngine sendUpdate:@"twitter post"]; 

그것은 오류없이 빌드 :

여기 내 코드입니다. 내 응용 프로그램을 실행하면이 출력에서 ​​발생

은 [처리로 전환 1853 실이 0x0] Catchpoint 3 (던져) 2012-02-17 17 : 07 : 57.790 드리머 [1853 : 1203] MGTwitterEngine : 최종 URL 07 : = http://api.twitter.com/1/statuses/update.xml

2012-02-17 17 57.791 드리머 [1853 : 1203] MGTwitterEngine : finalBody = 상태 = 트위터 % 20post

,691,363 [1,853 0x620b 스레드를 처리하도록 전환]210 2012-02-17 18 : 30 : 38.491 Dreamer [2067 : 1203] connectionIdentifier = DAAC2B20-91B6-49A6-90CA-4FD0606DA2FB에 대한 요청이 실패했습니다. 오류 = 작업을 완료 할 수 없습니다. (HTTP 오류 401) ({ 체 = "\ n \ n 읽기 전용 \ n 개의 /1/statuses/update.xml\n\n를 게시 할 수있는 어플리케이션"; 응답 = ""; })를

트위터에 트윗이 표시되지 않습니다.

나는 dev.twitter.com에 응용 프로그램을 등록하고 문제가있을 수 있습니다 Read, Write and Access direct messages

으로 접근을 넣어?

답변

1

문제가 해결되었습니다.

같은 문제에 직면하게 될 것이다 사람이 다음 변경 액세스 한 후 액세스 토큰 키를 다시 생성하는 경우

+0

http://stackoverflow.com/questions/4613727/iphone-why-i-got-this-error-http-error -401- 지저귐 –

관련 문제