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 7023421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:42:32+00:00 2026-05-27T23:42:32+00:00

I have a IOS app, that uses a network connection, and at times, it

  • 0

I have a IOS app, that uses a network connection, and at times, it looses this network connection, whenever it does, I want the app to move back to a specific UIViewController.. What is the best way to achieve this?

Can I do this from the appDelegate?

  • 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-05-27T23:42:33+00:00Added an answer on May 27, 2026 at 11:42 pm

    Are you using the Reachability class described in the Apple documentation? If not, you should take a look at it. It will give you network status, including whether you are connected to the internet. It has a notification of network status change so you can put an observer in you app delegate or anywhere else you need it to accomplish your objective.

    There is a lot of help already available on the web with examples on how to use Reachability, and this one may be something you can start with.

    Update

    Raachability change notifications can be used to inform your app when the connection is lost or restored. See the notification statement in the code below for the Reachability class;

    static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
    
    {
    
        #pragma unused (target, flags)
    
        NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback");
    
        NSCAssert([(NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback");
    
    
    
        //We're on the main RunLoop, so an NSAutoreleasePool is not necessary, but is added defensively
    
        // in case someon uses the Reachablity object in a different thread.
    
        NSAutoreleasePool* myPool = [[NSAutoreleasePool alloc] init];
    
    
    
        Reachability* noteObject = (Reachability*) info;
    
        // Post a notification to notify the client that the network reachability changed.
    
        [[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification object: noteObject];
    
    
    
        [myPool release];
    
    }
    

    For this to work you have to call startNotifier:

    - (BOOL) startNotifier
    
    {
    
        BOOL retVal = NO;
    
        SCNetworkReachabilityContext    context = {0, self, NULL, NULL, NULL};
    
        if(SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context))
    
        {
    
            if(SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode))
    
            {
    
                retVal = YES;
    
            }
    
        }
    
        return retVal;
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an iOS app that uses a SQLite DB to store its data
I have an app for iOS that uses Filesharing to provide the user with
I have developed an iOS app that uses CoreData/SQLite. It works, but now I
Using iOS 4.3 on an ipad app I have a custom NSOperation that uses
I'm working on an iOS app that uses an NSTimer for a countdown. This
I have a Rails app that has 2 clients -- an iOS app reads/writes
I have an app on my iPhone that was built on iOS 5 and
I have an iOS app and I want to make it accessible. Everything goes
Back Story: I was approached to write an app, but iOS isn't something that
I'm developing an app that uses iOS4 features (like MFMessageComposeViewController), but I want to

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.