5
I set up a Builder interface to load a webview, with . h, . m and .xib. In a side menu, when clicking on an option, I need to call this webview. Running the application, clicking on this option returns me the error "Thread 1: Signal SIGABRT" 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";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
}
@end
.xib file:
Nib call:
if([SINControler userLogado] == nil){
[SINControler setUserLogado:nil];
WebViewCadastro *curriculocontroller = [[WebViewCadastro alloc]
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 an obvious mistake? Is there any solution available? Thank you.
Thank you. Now it opens the webview, but does not load the google page. Any suggestions?
– Camila Cardoso
It’s probably because of the App Transport Security (ATS) settings. https://answall.com/questions/91156/webview-em-ios-n%C3%A3o-est%C3%A1-accessing-some-sites/91170#91170
– Rafael Leão