UIWebview不会显示Https(iPhone) [英] UIWebview wont Display Https (iPhone)

查看:173
本文介绍了UIWebview不会显示Https(iPhone)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我写了一个UIWebView但是当我尝试加载一个https页面时它不会加载...这是我的.m页面的WebView。

So i wrote up a UIWebView but when i try to load an https page it wont load... here is my .m page for the WebView.

 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
 self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
 if (self) {
 // Custom initialization.
 }
 return self;
 }
 */


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"https://psportal.hbuhsd.org/ResetPassword.aspx"]]];
    webView.scalesPageToFit = YES;

    //Navigation Name:
    self.title = @"facebook";


    [super viewDidLoad];
}

-(void)webViewDidStartLoad:(UIWebView *)webView {
    [activityIndicator startAnimating];
    activityIndicator.hidden = NO;
}

-(void)webViewDidFinishLoad:(UIWebView *)webView {
    [activityIndicator stopAnimating];
    activityIndicator.hidden = YES;
}


推荐答案

第1步:确保你的webView是否已连接到您的xib?

Step1 : Make sure you webView is connected to your xib?

步骤2:如果您尝试使用xib
覆盖init方法调用viewController

Step2 : If you are trying to call your viewController with xib override the init method

 -(id)init{
   return [self initWithNibName:@"YourNibFileName" bundle:nil]
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.title = @"facebook";
    }
    return self;
}

并使用init方法
初始化您的类,例如:

And initialize your class with just init method for example :


YourViewController * _YVC = [[YourViewController alloc] init ] autorelease];

YourViewController *_YVC = [[YourViewController alloc]init]autorelease];

加载视图后

- (void)viewDidLoad {
    NSString* _urlString = @"https://psportal.hbuhsd.org/ResetPassword.aspx";
    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:_urlString]]];
    //webView.scalesPageToFit = YES;
    [super viewDidLoad];
}

并实现所有必需的webView委托方法,特别是 didFailLoadWithError 告诉您网络视图是否无法加载内容

and implement all the required webView delegate method specially didFailLoadWithError (which tells you if a web view failed to load content)

这篇关于UIWebview不会显示Https(iPhone)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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