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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:22:15+00:00 2026-05-28T00:22:15+00:00

I have written a tab based application in Xcode/RestKit and am attempting to use

  • 0

I have written a tab based application in Xcode/RestKit and am attempting to use the RKReachabilityObserver to determine Internet connectivity on the device.

Ideally I’d like to have a single reachability variable throughout my application (if this is possible) but currently my implementation is as per the code below and does not work very well when replicated over my 4 tabs.

If anybody has any suggestions of a better way to do this, I’d really appreciate your comments.

View.h

@property (nonatomic, retain) RKReachabilityObserver *observer;

View.m

@interface AppViewController()
{
    RKReachabilityObserver *_observer;
}
@property (nonatomic) BOOL networkIsAvailable;
@synthesize observer = _observer;

-(id)initWithCoder:(NSCoder *)aDecoder {

    if ((self = [super initWithCoder:aDecoder])) {

        self.observer = [[RKReachabilityObserver alloc] initWithHost:@"mydomain"];
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(reachabilityChanged:)
                                                     name:RKReachabilityDidChangeNotification
                                                   object:_observer];
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    // determine network availability
    if (! [_observer isReachabilityDetermined]) {
        _networkIsAvailable = YES;
    }
    else
    {
        _networkIsAvailable = NO;
    }

    _text.returnKeyType = UIReturnKeyDone;
    _text.delegate = self;
}

- (void)reachabilityChanged:(NSNotification *)notification {
    RKReachabilityObserver* observer = (RKReachabilityObserver *) [notification object];
    if ([observer isNetworkReachable]) {
        if ([observer isConnectionRequired]) {
            _networkIsAvailable = YES;
            NSLog(@"Reachable");
            return;
        }
    } 
    else 
    {
        _networkIsAvailable = NO;
        NSLog(@"Not reachable");
    }
}

then anywhere in my view, I simply do….

if (_networkIsAvailable == YES)
    {...

I have implemented this over multiple views (which seems to be causing the problem.

What is the suggested approach for a multiple-view application?

  • 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-28T00:22:15+00:00Added an answer on May 28, 2026 at 12:22 am

    The [RKClient sharedClient] singleton already has a property for that (reachabilityObserver). Feel free to use that one.

    if ([[[RKClient sharedClient] reachabilityObserver] isReachabilityDetermined] && [[RKClient sharedClient] isNetworkReachable]) {
        ....
    }
    

    You can also subscribe to RKReachabilityObserver notifications (if you want to take any action when reachability status changes)

        [[NSNotificationCenter defaultCenter] addObserver:self 
                                                 selector:@selector(reachabilityStatusChanged:) 
                                                     name:RKReachabilityDidChangeNotification object:nil];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a tab based iPad application which has done well. I never
I have written tab for my android application. My question is switching between tab
I have written an AIR Application that downloads videos and documents from a server.
I have written some code in my VB.NET application to send an HTML e-mail
I have written an image processing application with the GUI part written in Java
I have written a Silverlight application that is basically an account registration form. I
I have written the code programmatically for my tab bar in my table view.The
I have written an extension in Google Chrome that opens a tab to a
Can someone recommend a fast unix-based utility (ideally written in C) for getting efficient,
I have been looking for a Google Chrome-like tab written using CSS but cannot

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.