White Screen on Simulator Iphone Xcode
I Watched This Video on Youtube: Xcode How to Create a Webview for iOS Applications I Followed Video but If I Run My App on Simulator, Only I See White Screen...
I watched this video on YouTube : Xcode How to Create a Webview for iOS Applications
I followed video but if I run my app on simulator, only I see white screen.
This ViewController.h
//
// ViewController.h
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
{
IBOutlet UIWebView *myWebView;
}
@end
//
// ViewController.m //
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSURL *myURL = [NSURL URLWithString:@""]; NSURLRequest *myRequest = [NSURLRequest requestWithURL:myURL]; myWebView.scalesPageToFit = YES; [myWebView loadRequest:myRequest];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
Can you get me fix this error?
2 Answers
tHis ViewController.m
//
// ViewController.m
//
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSURL *myURL = [NSURL URLWithString:@""]; NSURLRequest *myRequest = [NSURLRequest requestWithURL:myURL]; myWebView.scalesPageToFit = YES; [myWebView loadRequest:myRequest];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
You have to actually load the request after you create it!
NSURL *url = [NSURL URLWithString:@""];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:request];