首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Twitter SLRequest on OSX返回错误32

Twitter SLRequest on OSX返回错误32
EN

Stack Overflow用户
提问于 2013-11-17 16:05:17
回答 2查看 212关注 0票数 1

在OSXMavericks10.9上为SLRequest执行一个TwitterforTwitter10.9返回“无法对您进行身份验证”,错误代码32用于任何Twitter请求。下面是简单的代码片段。

代码语言:javascript
复制
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似乎是有效的,preparedURLRequest似乎有所有的OAuth headers,我不确定什么可能是错误的.有什么想法吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-02-19 14:46:15

显然,这个URL不再存在于HTTP或HTTPS上,除非在发布问题时,Twitter的响应是错误32,我猜这是一个错误。

不管怎么说,其他URL都能正常工作。

票数 0
EN

Stack Overflow用户

发布于 2014-02-11 20:10:17

有点晚了,但是您需要指定https。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20032901

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档