Idrees Ashraf
Idrees Ashraf

Reputation: 1383

Navigating back from UIViewController causes crash

I am just using this piece of code in viewDidLoad method. It only opens the web page in UIWebView and that's it. But when I go back to the previous view It cause crash. here is the code:

NSString *urlAddress = @"http://www.google.com";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[moreWeb loadRequest:requestObj];

Upvotes: 0

Views: 138

Answers (1)

Loquatious
Loquatious

Reputation: 1775

Just stop loading like this:

-(void)viewWillDisappear:(BOOL)animated{
[moreWeb stopLoading];
moreWeb.delegate = nil;
}

it'll work fine.

Upvotes: 3

Related Questions