0
votes

I am using XCode 7 and iOS 9 and I added a UIWebView to my storyboard scene

and did the following:

Connected it to my header file and added the UIWebViewDelegate:

@interface LHPurchaseOrderDetail : UIViewController<UIWebViewDelegate>

@property (strong, nonatomic) IBOutlet UIWebView *viewWeb;

and then did this in my .m file:

- (void)viewDidLoad {
        
        [super viewDidLoad];
        
        NSLog(@"WebView : %@",_viewWeb);
        
        [_viewWeb setDelegate:self];
        
        NSString *fullURL = [NSString stringWithFormat:@"http://www.google.com"];
        
        NSURL *url = [NSURL URLWithString:fullURL];
        NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
        [_viewWeb loadRequest:requestObj];
        
    }

and that NSLog returns this:

WebView : <UIWebView: 0x7a7e85a0; frame = (0 0; 240 128); autoresize = RM+BM; layer = <CALayer: 0x7a7d8d90>>

I have these two methods:

- (void)webViewDidFinishLoad:(UIWebView *)webViewIn {
        NSLog(@"web view did finish loading");
    }

and

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
    {
        NSLog(@"Error : %@",error);
    }

Error does not show up in my log, but web view did finish loading did

But the UIWebView does not appear. This is inside an Detail View Controller, this is a contraints issue with my storyboard, I don't know anything about contraints so you would have to be specific. What Am I doing wrong? Why isnt my UIWebView Appearing?

Here is an image of my storyboard:

enter image description here

1
That's a really small web view. Try making it larger and make sure it's not behind any other views.rmaddy
i guess 240x128 is not a small frame @rmaddyTeja Nandamuri
Are you sure it didn't appear? Have you tried inspecting if it really is there with Debug View Hierarchy?Soberman

1 Answers

1
votes

There is nothing wrong with your code,except you have to replace http with https.

This is the new thing introduced in ios9.

App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.