Load WebView in Objective c

4

I set up a builder interface to load a webview, with .h, .m, and .xib. In a side menu, when I click on an option, I need to call this webview. Running the application, clicking this option returns the error "Thread 1: SIGABRT signal" in main.m.

.h file:

#ifndef WebViewCadastro_h
#define WebViewCadastro_h


#endif /* WebViewCadastro_h */


#import <UIKit/UIKit.h>

@interface WebViewCadastro : UIViewController{
    IBOutlet UIWebView *webView;
}

@property (nonatomic, retain) UIWebView *webView;

@end

.m file:

#import "WebViewCadastro.h"

@implementation WebViewCadastro

-(void)viewDidLoad{
    [super viewDidLoad];
    NSString *urlAddress = @"https://www.google.com.br";
    NSURL *url = [NSURL URLWithString:urlAddress];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [webView loadRequest:requestObj];
}

@end

.xib file:

Callingnib:

if([SINControleruserLogado]==nil){[SINControlersetUserLogado:nil];WebViewCadastro*curriculocontroller=[[WebViewCadastroalloc]initWithNibName:@"WebViewCadastro" bundle:nil];

                UINavigationController *navigationController = self.menuContainerViewController.centerViewController;
                NSArray *controllers = [NSArray arrayWithObject:curriculocontroller];
                navigationController.viewControllers = controllers;
                [self.menuContainerViewController setMenuState:MFSideMenuStateClosed];
                [self.menuContainerViewController setLeftMenuViewController:nil];

Am I making any obvious mistakes? Any solution available? Thank you.

    
asked by anonymous 04.05.2017 / 14:19

1 answer

3

You need to connect the outlet's 'view' interface with the File's Owner. The same way you did with 'webView'.

    
04.05.2017 / 16:05