iPhone – UIWebView loading but not displayed (Xcode 4, iOS SDK 4.3)

I plan to write an application that includes UIWebView. So first I want to try it out by simply loading the URL.

>Create in Interface Builder UIWebView
>Connect to the code

@property (non-atomic, reserved) IBOutlet UIWebView * webView;

viewDidLoad:

< pre>– (void)viewDidLoad {
[super viewDidLoad];
if(!webView)
{
webView = [[UIWebView alloc]init];
}

webView.delegate = self;

[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@”http://www.google.com”]]]; }

I also implemented the didFailLoadWithError and webViewDidFinishLoad delegate methods.
Call webViewDidFinishLoad and indicate that HTML has been loaded.

The problem is: Even if webViewDidFinishLoad is called, UIWebView will not display the website. It only shows white. When you touch and drag the UIWebView but do not display the content, the scroll bars on the right and bottom are displayed. Nothing is found. It looks weird..

Edit
This The screenshot shows the connection of the xib:

Connections

if you correctly If everything is connected in Interface Builder, the following line is not required:

if(!webView)
{
webView = [[ UIWebView alloc]init];
}

webView.delegate = self;

Try to delete them and see what happens. Also, put an NSLog(…) in webView:didFailLoadWithError:callback and see if it is output.

I plan to write an application that includes UIWebView. So first I want to try it out by simply loading the URL.

>Create UIWebView in Interface Builder
>Connect to the code

@property (non-atomic, reserved) IBOutlet UIWebView * webView;

in viewDidLoad:

- (void)viewDidLoad { 
[super viewDidLoad];
if(!webView)
{
webView = [[UIWebView alloc]init];
}

webView.delegate = self;

[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.com"]]]]; }

I also implemented didFailLoadWithError and webViewDidFinishLoad delegate methods.
Call webViewDidFinishLoad and indicate that HTML has been loaded.

The problem is: Even if webViewDidFinishLoad is called, UIWebView will not display the website. It only displays white. Touch and When dragging the UIWebView but not displaying the content, the scroll bars on the right and bottom are displayed. Nothing is found. It looks strange..

Edit
This screenshot shows the connection of the xib:

Connections

If you have correctly connected everything in Interface Builder, the following line is not required:

if(!webView)
{
webView = [[UIWebView alloc]init];
}

webView .delegate = self;

Try to delete them and see what happens. Also, put an NSLog(…) in webView:didFailLoadWithError:callback and see if it is output.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 1046 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.