我在 UIWebView 中加载 URL 时遇到问题。URL 重定向到不同的位置。我使用以下代码处理此重定向:
- (NSURLRequest *)connection:(NSURLConnection *)inConnection willSendRequest:(NSURLRequest *)inRequest redirectResponse:(NSURLResponse *)inResponse {
if(inResponse) {
NSMutableURLRequest *req = [[inConnection originalRequest] mutableCopy];
[req setURL:[inRequest URL]];
return req;
}
return inRequest;
}
但是,当页面加载时,我在所有图像上都得到 404。我可以毫无问题地在 Safari 中加载 URL。这发生在 iOS6.1 和 iOS7
我完全不知道该怎么做。不幸的是,我无法访问服务器,所以我必须处理我的应用程序中的所有内容。
感谢您的任何建议。