代码之家  ›  专栏  ›  技术社区  ›  jayant rawat

在模拟器中加载web视图,但不在我的设备中加载(ios 8)

  •  0
  • jayant rawat  · 技术社区  · 11 年前

    web视图在模拟器中加载良好,但在我的ios 8版本的设备中加载不好。以下是我的代码

    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"BGColor.jpg"]];
    self.navigationItem.title = textType;
    
    //[self createHUD];
    linkWebView = [[UIWebView alloc] init];
    if(self.navigationController.viewControllers)
      linkWebView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, phoneType-105);
    else
       linkWebView.frame = CGRectMake(0, 0+60, [UIScreen mainScreen].bounds.size.width, phoneType-63);
    linkWebView.delegate = self;
    [self.view addSubview:linkWebView];
    
    indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    indicator.frame = CGRectMake(([[UIScreen mainScreen] bounds].size.width/2)-18, ([UIScreen mainScreen].bounds.size.height/2)-45-15, 40, 40);
    indicator.hidesWhenStopped = YES;
    [indicator startAnimating];
    [self.view addSubview:indicator];
    
    urlStr = appDelegate.selectedURL;
    
    if ([textType isEqualToString:@"About"])
    {
        [linkWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/index/about.html?jsonFooter=hideHeaderFooter",urlStr]]]];//about.html
    
    }
    

    它在其他ios 6版本的设备上运行良好。为什么它在我的设备上不工作?提前谢谢

    1 回复  |  直到 11 年前
        1
  •  0
  •   Duncan Lowrie    11 年前

    “textType”肯定会是大写“A”的“About”吗?尝试在条件内插入断点或NSLog()。此外,尝试将loadRequest参数分离到变量中,以便检查每个部分是否正确填充。