UIWebview wont Display Https (iPhone)
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:[NSU开发者_StackOverflow社区RLRequest 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;
}
Step1 : Make sure you webView is connected to your xib?
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;
}
And initialize your class with just init method for example :
YourViewController *_YVC = [[YourViewController alloc]
init
]autorelease];
and after loading the view
- (void)viewDidLoad {
NSString* _urlString = @"https://psportal.hbuhsd.org/ResetPassword.aspx";
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:_urlString]]];
//webView.scalesPageToFit = YES;
[super viewDidLoad];
}
and implement all the required webView delegate method specially didFailLoadWithError (which tells you if a web view failed to load content
)
精彩评论