iOS UIWebView无法正确显示网站
我正在创建一个简单的UIWebView,如图所示。 所有工作正常,但网站已损坏。看起来,图像没有加载 奇怪的是,在浏览器中,同一个页面加载的是好的,有什么想法吗iOS UIWebView无法正确显示网站,ios,iphone,ios7,uiwebview,Ios,Iphone,Ios7,Uiwebview,我正在创建一个简单的UIWebView,如图所示。 所有工作正常,但网站已损坏。看起来,图像没有加载 奇怪的是,在浏览器中,同一个页面加载的是好的,有什么想法吗 #import "WebViewController.h" @interface WebViewController () @property NSURL *adUrl; @property (weak, nonatomic) IBOutlet UIWebView *webView; @end @implementation We
#import "WebViewController.h"
@interface WebViewController ()
@property NSURL *adUrl;
@property (weak, nonatomic) IBOutlet UIWebView *webView;
@end
@implementation WebViewController
-(id) initWithUrl:(NSURL *)url
{
self = [super init];
if (self)
{
self.adUrl = [NSURL new];
self.adUrl = url;
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self.webView loadRequest:[NSURLRequest requestWithURL:self.adUrl]];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
任务解决了。问题是,负责WebCaching的旧类干扰了重定向,从而抑制了baseURL对象的加载。谢谢你给了我解决问题的方法。
干杯我已经看到了在UIWebView中正确加载的大型网站,顺便说一句,您正在真实设备上测试它?还可以尝试在Safari浏览器中打开同一个网站。您可以查看网页源代码并对其进行分析。真实设备或模拟器看起来是一样的。在Safari浏览器中,它看起来完全可以使用完全相同的URLokey!现在在两者的Safari浏览器中打开网站。在浏览器中它确实看起来不错。