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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:06:12+00:00 2026-06-05T12:06:12+00:00

I incorporated the Reachability Code into my app and its been successfully working for

  • 0

I incorporated the Reachability Code into my app and its been successfully working for a few months but so far I’ve only used it on iOS 5 devices.
However it doesn’t work on an iOS 4 device.

The notification is registered for as follows:

 - (id) init
{
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(reachabilityChange:)
                                                 name:kReachabilityChangedNotification
                                               object:nil];

...


- (void) appBecameActive
{
...
self.reachability = [Reachability reachabilityWithHostName:[url host]];
...
[self.reachability startNotifier];

stopNotifier is only getting called in dealloc

The problem is the ReachabilityCallback isn’t getting called back when there is a reachabiity change, but I cannot see any reason why it should it ok on iOS5 but not iOS4.

This part of the code is unchanged from the Apple sample source code:

static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info) {
#pragma unused (target, flags)
  NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback");
  NSCAssert([(__bridge id)info isKindOfClass:[Reachability class]], @"info was wrong class in ReachabilityCallback");

  Reachability *noteObject = (__bridge Reachability *)info;
  // Post a notification to notify the client that the network reachability changed.
  [[NSNotificationCenter defaultCenter] postNotificationName:kReachabilityChangedNotification object:noteObject];
}

As mentioned, everything has been working fine for a long time when running on iOS5 devices, has anybody else encountered a similar issue in the past incorporating the reachability code into with iOS4?

  • 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-05T12:06:13+00:00Added an answer on June 5, 2026 at 12:06 pm

    Edit the code in reachability that posts the notification to post it on the main thread, and see if that changes the behavior you’re seeing.

    dispatch_async(dispatch_get_main_queue(), ^{ 
        [[NSNotificationCenter defaultCenter] postNotificationName:kReachabilityChangedNotification object:noteObject];
    });
    

    (assume you are listening for them on the main thread)

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

Sidebar

Related Questions

I've currently got TinyMCE incorporated into the backend editor of a simple blogging/page-editing app,
The following code works fine as a independant page as itself. But if incorporated
I have incorporated the mini-profiler in mvc app but I have a question. When
I've incorporated Apple's Reachability sample into my own project so I know whether or
I incorporated a gettext-like localization system in my app, but my translation function looks
I've incorporated the really awesome AQGridView into my project but am having a small
I have made a custom formwizard and incorporated it into my admin interface. Basically
After reading some articles about XSS I have incorporated HTMLPurifier into my zend framework
I am looking for a 3rd party licensing module that can be incorporated into
I'm using JSF 2.0 and it's new (actually old, but now incorporated in JSF)

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.