简体   繁体   English

AFNetworking问题与UStream API请求频道的视频列表有关

[英]AFNetworking issue with UStream API request for channel's video list

This is probably something simple that I am just overlooking. 我可能只是简单地忽略了这一点。 I am trying to make an AFHTTPRequest from uStream's API using AFNetworking. 我正在尝试使用AFNetworking从uStream的API发出AFHTTPRequest。 I should be getting a JSON payload response back that lists all the videos on a uStream Channel. 我应该返回一个JSON有效负载响应,其中列出了uStream Channel上的所有视频。 Here is my code: 这是我的代码:

NSURL *url = [NSURL URLWithString:@"https://api.ustream.tv/channels/12321320/videos.json"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];

AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
operation.responseSerializer = [AFJSONResponseSerializer serializer];

[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
    NSLog(@"success");

} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
    NSLog(@"failed");
}];

[operation start];

Everything works fine when testing in a browser but when trying to use AFNetworking I get a NSURLErrorDomain failure. 在浏览器中测试时,一切正常,但是尝试使用AFNetworking时,出现NSURLErrorDomain失败。 Anyone have any suggestions? 有人有什么建议吗?

My code was fine but there was an issue with my iphone simulator. 我的代码很好,但是我的iPhone模拟器出现了问题。 Reset Content and Settings did the trick. 重置内容和设置可以解决问题。 Thanks to k6sandeep for the help. 感谢k6sandeep的帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM