我想获取用户的推文。
以下代码是使用 twitter API 并获取用户的推文。
但是日志输出 data:{"errors":[{"message":"SSL is required","code":92}]}
- (void)getJSON
{
NSURL* url = [NSURL URLWithString"http://api.twitter.com/1.1/statuses/user_timeline.json"];
OAConsumer* consumer = [[OAConsumer alloc]initWithKey:kTwitterAPIKey secret:kTwitterAPISecret];
OAMutableURLRequest* request = [[OAMutableURLRequest alloc]initWithURL:url consumer:consumer token:_responseToken realm:nil signatureProvider:nil];
[request setHTTPMethod"OST"];
OADataFetcher* fetcher = [[OADataFetcher alloc]init];
[fetcher fetchDataWithRequest:request delegate:self didFinishSelectorselector(getData:didFinishWithData didFailSelectorselector(failedToGet:didFailWithError];
}
- (void)getDataOAServiceTicket *)ticket didFinishWithDataNSData *)data
{
NSString* responseBody = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
NSLog(@"data:%@", responseBody);
}
我需要使用 SSL 吗?如何使用 SSL?
你有什么想法吗?
在您的网址中使用“https”:
https://api.twitter.com/1.1/statuses/user_timeline.json
这一定足以解决问题。
关于ios - Twitter API 返回错误 : SSL is required(92),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26030587/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |