当我将网站加载到 cocoa 应用程序的 webview 中时,就会出现此问题。 我的问题描述:
Error Domain=NSURLErrorDomain Code=-1007 "too many HTTP redirects" UserInfo=0x18d17d56{NSErrorFailingURLStringKey=URLHERE, NSErrorFailingURLKey=URLHERE,NSLocalizedDescription=too many HTTP redirects}
为什么会出现这个错误
如何处理
我点击了以下链接,但对我没有帮助
Too many HTTP redirects
"too many HTTP redirects" while using Alamofire Upload Multipart Form Data
too many HTTP redirects, Google Drive, iOS SDK还有更多..
更新:
- (NSURLRequest *)webView:(WebView *)sender resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)dataSource {
if(redirectResponse)
{
if([redirectResponse.URL.absoluteString isEqualToString:self.webviewLoadingURL.absoluteString])
{
NSLog(@"both redirect and load url is same");
}
}
return request;
}
我在 webview 中获得了相同的重定向和加载 URL。
最佳答案
我在 iPhone XS 上发生过这种情况。无论我做了什么,它都仅针对特定网址报告“太多 HTTP 重定向”。即使没有互联网连接!删除该应用并重新安装即可解决问题。
关于objective-c - 如何处理 "too many HTTP redirects"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38702529/