【问题标题】:iOS UIWebView does not show the websites correctiOS UIWebView 未正确显示网站
【发布时间】:2014-06-24 12:42:03
【问题描述】:

我正在创建一个如图所示的简单 UIWebView。 一切正常,但网站已损坏。看起来,图像没有加载。

奇怪的是,在浏览器中,相同的页面正在加载正常 O_o 有什么想法吗?

#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

【问题讨论】:

  • 我已经看到在UIWebView 中正确加载的大型网站,顺便说一句,您是在真实设备上测试这个吗?也尝试在 Safari 浏览器中打开相同的网站。
  • 可以查看网页源码并进行分析。
  • 真实设备或模拟器看起来确实一样。在 Safari 浏览器中,使用完全相同的 URL 看起来完全没问题
  • 好吧!现在在两者的 Safari 浏览器中打开网站。
  • 在浏览器中看起来不错。

标签: ios iphone ios7 uiwebview


【解决方案1】:

任务已解决。问题是,负责 WebCaching 的旧类扰乱了重定向,从而抑制了 baseURL 对象的负载。感谢您给我解决方法的想法。 干杯

【讨论】:

    猜你喜欢
    • 2015-05-13
    • 1970-01-01
    • 2015-11-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-28
    • 1970-01-01
    • 2018-06-28
    相关资源
    最近更新 更多