Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7732627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:46:40+00:00 2026-06-01T06:46:40+00:00

I have an application with tabs that are all webviews. I’m using UIWebViewDelegate so

  • 0

I have an application with tabs that are all webviews. I’m using UIWebViewDelegate so that I get errors when the device loses access to the internet. I’m also using the Reachability class to track any changes in connection status.

The problem is this:

  1. I go to tab one
  2. Kill my internet connection (I get the message saying I lost the internet connection)
  3. I go to tab two (while the internet connection is gone)
  4. I get a error message in tab two via the UIWebViewDelegate method didFailLoadWithError
  5. I reconnect the internet
  6. I hit the refresh button that I created and I don’t get anything. THIS IS THE PROBLEM
  7. If I go back to tab one or any other tab, it works fine

I’m sure that once the UIWebView errors out that I need to reinitialize something but I don’t know what??????

Here’s the code for the tab.

#import "MINWebTab2Controller.h"

@implementation MINWebTab2Controller
@synthesize webView;
@synthesize timer;
@synthesize progressIndicator;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
    // Custom initialization
}
return self;
}

- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];

// Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.

// Set up progress indicator for web page load
//timer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self            selector:@selector(webViewLoading) userInfo:nil repeats:YES];
//[progressIndicator startAnimating];

webView.delegate = self;
webView.scalesPageToFit = YES;

NSString *urlAddress = @"http://www.mobilityinitiative-synergy.com/index.php/presentations";

//Create a URL object.
NSURL *url = [NSURL URLWithString:urlAddress];

//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];

//Load the request in the UIWebView.
[webView loadRequest:requestObj];

}

- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return YES;
}

#pragma mark UIWebViewDelegate methods
- (void)webViewDidStartLoad:(UIWebView *)thisWebView
{
[progressIndicator startAnimating];
}

- (void)webViewDidFinishLoad:(UIWebView *)thisWebView
{    
//stop the activity indicator when done loading
[progressIndicator stopAnimating]; 
}

-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
NSLog(@"Error for WEBVIEW: %@", [error description]);
[progressIndicator stopAnimating];
}

@end

This is the code to the main delegate class. As you can see, I’m am using the Reachability class (a derivative of) provided by Apple.

#import "MINAppDelegate.h"
#import "Reachability.h"

@implementation MINAppDelegate

@synthesize window = _window;
@synthesize rootController;
@synthesize connectedToInternet;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
connectedToInternet = YES;

// Set up Root Controller
[[NSBundle mainBundle] loadNibNamed:@"TabBarController" owner:self options:nil];
[self.window addSubview:rootController.view];

// Observe the kNetworkReachabilityChangedNotification. When that notification is posted, the
// method "reachabilityChanged" will be called. 
[[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(reachabilityChanged:) name: kReachabilityChangedNotification object: nil];

// allocate a reachability object
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];

// here we set up a NSNotification observer. The Reachability that caused the notification
// is passed in the object parameter
[[NSNotificationCenter defaultCenter] addObserver:self 
                                         selector:@selector(reachabilityChanged:) 
                                             name:kReachabilityChangedNotification 
                                           object:nil];

[reach startNotifier];


self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}

//Called by Reachability whenever status changes.
- (void) reachabilityChanged: (NSNotification* )note
{        
Reachability * reach = [note object];

if([reach isReachable])
{
    if(connectedToInternet == NO)
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Network Change Detected" 
                                                        message:@"You are now connected to the internet and can continue to use application." 
                                                       delegate:nil 
                                              cancelButtonTitle:@"OK"
                                              otherButtonTitles:nil];
        [alert show];
    }
    connectedToInternet = YES;
}
else
{
    if(connectedToInternet == YES)
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Network Change Detected" 
                                                        message:@"You must be connected to the internet to use this app.  Please connect to internet and reload the application." 
                                                       delegate:nil 
                                              cancelButtonTitle:@"OK"
                                              otherButtonTitles:nil];
        [alert show];
        //exit(0);
    }
    connectedToInternet = NO;
}    
}

- (void)applicationWillResignActive:(UIApplication *)application
{
/*
 Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
 Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
 */
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
/*
 Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
 If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
 */
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
/*
 Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
 */
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
/*
 Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
 */
}

- (void)applicationWillTerminate:(UIApplication *)application
{
/*
 Called when the application is about to terminate.
 Save data if appropriate.
 See also applicationDidEnterBackground:.
 */
}

@end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:46:42+00:00Added an answer on June 1, 2026 at 6:46 am

    I’m not sure that this is the best solution but here’s what I did.

    I moved the code to launch the webview from viewDidLoad to viewDidAppear. The viewDidAppear method gets called when I go to the tab. In that method, I call the appropriate lines of code to relaunch the webview ([webview loadRequest:URL];)

    I also added a flag to bPageLoaded and set this to false incase there was an error in loading the webpage. I check that flag in the viewDidAppear method so that I’m not redrawing the page except when there was an error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have an application that has a tabActivity and 3 tabs. all off the
I'm developing an iPhone application that have a TabBarController with two tabs. Each tab
I am using tab host(tabs) in application, it have four tabs on home screen,
I have a pretty big web application that I created last year using ASP.NET
I have a web application that has been running just fine in Internet Explorer
I have a .NET forms application using a tab control with several tabs. There
I am building an application that has the functionality like 3 tabs created using
I have an application that has a UITabBarController with two tabs, each having its
I have web application in that i am using tabbed interface control in this
I have an application using Jquery's UI Tabs for an overall menu, and they're

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.