Ahmed Abdallah
Ahmed Abdallah

Reputation: 2355

UIWebView not display any content

I used UIWebView with my app I set the default like the next code:-

WebViewViewController.h

@interface WebViewViewController :UIViewController<UIWebViewDelegate>
@property (strong, nonatomic) NSString *url;
@property (weak, nonatomic) IBOutlet UIWebView *webview;
@end

WebViewViewController.m



NSURL *url=[NSURL URLWithString:@"facebook.com"];

    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [_webview loadRequest:requestObj];

web view appear but with no data.

Upvotes: 0

Views: 115

Answers (2)

Rohit suvagiya
Rohit suvagiya

Reputation: 1015

Replace only URL and check the connection and delegate.

Remove Your .m file code and put my code.

NSURL *url=[NSURL URLWithString:@"https://www.facebook.com"];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[_webview loadRequest:requestObj];

Upvotes: 1

rmaddy
rmaddy

Reputation: 318904

facebook.com is not valid URL.

It needs to be http://facebook.com.

Be sure you set the web view's delegate and implement the delegate methods such as webView:didFailLoadWithError:. Then you can see what errors you are getting when a page fails to load.

Upvotes: 2

Related Questions