UIWebView does not initially load specific URLs

You have such a strange problem with UIWebView, and I could not find a solution on the Internet. I have an iPad app that has a web view. When I first install and run the application, I try to download the training website . Web browsing just freezes and quits. I kill the application, I launch it again, and it loads just fine. It works well , which is also part of the education website. I am pulling my hair out!

Some codes:

-(void)viewDidAppear:(BOOL)animated
{
   NSURL *websiteUrl = [NSURL URLWithString:@"http://my.tac.edu.au"];
   NSURLRequest *urlRequest = [[NSURLRequest alloc]initWithURL: websiteUrl];
   [self.webView loadRequest:urlRequest];
}

Works great with www.tac.edu.au. I do not know what kind of this URL, which causes him to hang out only when the application is first installed. You stop it, start it again (without uninstalling), and everything will be fine. Any help would be appreciated.

+3
source share
1 answer

:)

instead of the view appeared, write that the code in the field of view will appear

-(void)viewWillAppear:(BOOL)animated
{
   NSURL *websiteUrl = [NSURL URLWithString:@"http://my.tac.edu.au"];
   NSURLRequest *urlRequest = [[NSURLRequest alloc]initWithURL: websiteUrl];
   [self.webView loadRequest:urlRequest];
   self.webview.delegate = self;
}

- (void)webViewDidStartLoad:(UIWebView *)webView{
  //Start Activity Indicator
}
- (void)webViewDidFinishLoad:(UIWebView *)webView{

   //End activity indicator
}
0
source

All Articles