質問

OSXのTwitterのSLREQUESTの実行Mavericks 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);
.

私にとって奇妙なことは、このの正確なコードスニペットが問題なくiOSで動作することです。Acaccountは有効であるようです、PrepareSurlRequestはすべてのOAuth HTTPヘッダーを持つように見えます、私はおそらく間違っている可能性がわからない...任意のアイデア?

役に立ちましたか?

解決 2

どうやら、このURLはhttpもhttpsには存在しません。

とにかく、すべてのURLとすべてがうまく機能します。

他のヒント

少し遅れたが、HTTPSを指定する必要があります。:-)あなたの問題を解決するためにもっと必要かどうか、私は知りません!

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top