【发布时间】:2016-02-02 19:28:20
【问题描述】:
因为今天我遇到了一些严重的问题,AFNetworking 请求一个我想要返回一些 XML-Info 的 https 链接,昨天它已经工作了,我还发送了一些 TestFlight-Links,所以这非常令人沮丧。我也没有对服务器配置做任何更改。
但是今天我收到了错误 -1007 “too many http redirects”。有人也遇到过这样的问题吗?我已经看到了iOS 9的帖子:"too many HTTP redirects" while using Alamofire Upload Multipart Form Data 但是我找不到他们所说的这个属性。 有人能帮助我吗? 这是我为获取响应 XML 所做的数据任务的配置,希望对您有所帮助。
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:35];
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];
showNetworkActivityIndicator();
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
NSURLSessionDataTask *dataTask = [manager dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
if (error) {
// Log error object
NSLog(@"AFNetworking error response: %@\n\n\n", error);
} else {
// NSLog(@"%@ %@", response, responseObject);
NSString *responseString = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
}
}];
[dataTask resume];
感谢您的帮助! 最好的问候
【问题讨论】:
-
你要去哪个网址?错误似乎很简单 - 您点击的 URL 将您重定向了太多次。
-
我知道 errortext 说明了一切 - 但我们没有在后台更改 anxthing 一切都像错误发生之前一样。就像我在前一天说的那样,在浏览器中一切正常:-S
-
哦,是的-https url,由于客服的限制,我不能在这里发布,但我可以私信发送?
标签: ios http redirect afnetworking