AFNetworking错误太多http重定向iOS 9
从今天开始,AFNetworking在请求https链接以获取一些XML-Info时遇到了一些严重问题,昨天它已经起作用了,并且我还发出了一些TestFlight-Links,因此非常令人沮丧.我也没有对服务器配置进行任何更改.
Since today I've got some serious problems with AFNetworking requesting an https link where I want to get back some XML-Info, yesterday it already worked and I also sent out some TestFlight-Links, so it's very frustrating. I also didn't do any changes to the server configuration.
但是今天我得到的错误是-1007太多的HTTP重定向".有人也有这样的问题吗?我已经看过iOS 9的帖子:";太多的HTTP重定向"在使用Alamofire上传多部分表单数据时但是我找不到他们正在谈论的这个属性.有谁可以帮助我吗?这是我为获取我的response-XML所做的数据任务的配置,希望对您有所帮助.
But today I'm just getting the error -1007 "too many http redirects". Did someone also had a problem like this? I already saw a post of iOS 9: "too many HTTP redirects" while using Alamofire Upload Multipart Form Data But I can't find this property they are talking of. Can someone help me please? Here is the configuration of the data task im doing for getting my response-XML, hope this helps.
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];
感谢您的帮助!最好的问候
thanks for help! best regards
当服务器不可用时,我尝试发送请求时遇到了同样的问题.然后,当服务器恢复活动时-发生此错误.
I had the same problem, occurred when I tried to send request when server was unavailable. Then when server comes alive - this error occured.
这对我有帮助:
URLCache.shared.removeAllCachedResponses()