문제

OSX에서 Twitter에 대한 SlRequest 실행 10.9 Twitter API 요청에 대한 오류 코드 32에서 "사용자를 인증 할 수 없습니다"를 반환합니다.간단한 코드 스 니펫은 아래에 있습니다.

ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];

dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
[accountStore requestAccessToAccountsWithType:accountType options:nil completion:^(BOOL granted, NSError *error) {

    ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
    NSArray *accountsArray = [accountStore accountsWithAccountType:accountType];
    ACAccount *account = [accountsArray lastObject];

    NSURL *url = [NSURL URLWithString:@"http://api.twitter.com/1.1/help/test.json"];
    SLRequest *r = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodGET URL:url parameters:nil];
    r.account = account;

    [r performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
        NSLog(@"%@", [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]);
        dispatch_semaphore_signal(semaphore);
    }];

}];

dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
.

나에게 이상한 것은 이것이이 exacture as rese 코드 스 니펫은 문제없이 iOS에서 작동한다는 것입니다.ACACCCOUNT가 유효합니다. PREPACTURLREQUEST는 모든 OAUTH HTTP 헤더가있는 것처럼 보입니다. 나는 무엇이 잘못 될 수 있는지 확신하지 못합니다 ... 어떤 아이디어?

도움이 되었습니까?

해결책 2

명백하게이 URL은 질문 게시물의시기를 제외하고는 HTTP도 HTTPS에 존재하지 않습니다. 트위터는 오류 32로 응답했습니다.

어쨌든, 모든 것이 다른 URL과 잘 작동합니다.

다른 팁

조금 늦었지만 https를 지정해야합니다.:-) 당신의 문제를 해결하기 위해 더 많은 필요가 있는지, 나는 모른다!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top