iOS 7 UIWebView无法加载网页 [英] iOS 7 UIWebView doesn't load webpage

查看:132
本文介绍了iOS 7 UIWebView无法加载网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序使用UIWebview,它在iOS 5和iOS 6中运行良好。但是,当我在Xcode 5中构建并运行相同的代码时,它不会在iOS 7中加载网页。

My app uses UIWebview, and it works well in iOS 5 and iOS 6. However, it doesn't load the webpage in iOS 7 when I build in Xcode 5 and run the same code.

 - (void)webViewDidFinishLoad:(UIWebView *)webView {}
 - (void)webViewDidStartLoad:(UIWebView *)webView {}
 - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {}

不调用所有委托函数。但是我在xib文件和代码中设置委托

All delegate function is not called. But I do set delegate in xib file and code

self.theWebView.delegate = self;

我没有通过谷歌找到任何信息。感谢您的帮助。

I didn't find any information via google. Thank you for your help.

推荐答案

我将loadRequest方法移动到presentViewController的完成处理程序,它在iOS 5中运行, 6和7:

I moved the loadRequest method to the completion handler of a presentViewController and it works in iOS 5, 6 and 7:

[self presentViewController:gwvc animated:YES completion:^(void){
    [gwvc.wv loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.walkjogrun.net/about/eukanuba.html"]]];
}];

这篇关于iOS 7 UIWebView无法加载网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆