UIWebView
's loadRequest method description:
Connects to a given URL by initiating an asynchronous client request.
It already makes a asynchronous call so you do not need to use another block. Just call [self.webView loadRequest:request];
You can handle errors on - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
method.
Other notes: Your url is not working right now and do not do any UI related work like showing an alert view on background thread. Hope it helps.
- (void)loadThrillsSite
{
[self.webView setDelegate:self];
NSString *urlString = @"https://www.Thrills.in";
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[self.webView loadRequest:request];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView;
{
[hudImageView removeFromSuperview];
[self.spinner stopAnimating];
[patternView removeFromSuperview];
}
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Connection Error!" message:@"Failed to connect to server\nPlease check your internet connection and try again" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
[alert show];
}