在OSX Mavericks上的Twitter上执行Slrequest 10.9返回“无法验证您”,错误代码32对于任何 twitter api请求。简单的代码片段如下所示。

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似乎有效,PupplatedUrlRequest似乎拥有所有OAuth HTTP标头,我不确定什么可能是错误的......任何想法?

有帮助吗?

解决方案 2

显然,除了问题帖子时,HTTP和HTTPS不存在该URL,Twitter正在响应错误32,我猜是一个错误。

无论如何,一切都与其他URL合作。

其他提示

很晚,但你需要指定https。:-)是否需要更多需要解决问题,我不知道!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top