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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:52:07+00:00 2026-05-14T07:52:07+00:00

I saw any post about Reachability but people doesn’t really give the exact answer

  • 0

I saw any post about Reachability but people doesn’t really give the exact answer to the problem.
In my application I use the Reachability code from apple and in my appDelegate I use this:


-(BOOL)checkInternet {

Reachability *reachability = [Reachability reachabilityWithHostName:@"www.google.com"];

NetworkStatus internetStatus = [reachability currentReachabilityStatus];
BOOL internet;

if ((internetStatus != ReachableViaWiFi) && (internetStatus != ReachableViaWWAN)) {
    internet = NO;
}else {
    internet = YES;
}
return internet;    
}

So the problem is even if I have an internet connection, this code telling me that I don’t have one.
Does anyone know what to do to make this working?

Thanks,

  • 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-14T07:52:08+00:00Added an answer on May 14, 2026 at 7:52 am

    You should probably be using +[Reachability reachabilityForInternetConnection] rather than reachability for a particular name (unless of course that’s what you actually need).

    There could be all manner of reasons that a particular server might not be reachable while you still have a working internet connection, after all.

    This is what I do:

    BOOL hasInet;
    Reachability *connectionMonitor = [Reachability reachabilityForInternetConnection];
    [[NSNotificationCenter defaultCenter]
        addObserver: self
        selector: @selector(inetAvailabilityChanged:)
        name:  kReachabilityChangedNotification
        object: connectionMonitor];
    
    hasInet = [connectionMonitor currentReachabilityStatus] != NotReachable;
    

    and then

    -(void)inetAvailabilityChanged:(NSNotification *)notice {
        Reachability *r = (Reachability *)[notice object];
        hasInet = [r currentReachabilityStatus] != NotReachable;
    }
    

    which works nicely for me.

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

Sidebar

Related Questions

I got excited when I saw the following post but it doesn't cover my
I saw a post on this already, but it didn't really provide a solution
I saw this question asked about C# I would like an answer for PHP.
I saw the post ( Adding song to itunes with C# sdk/api ) about
I saw this post on SO already but it still begs the question, at
More specifically, how to test further? I saw another post where the answer used
Is there any way to compute length of va_list ? All examples I saw
I very rarely meet any other programmers! My thought when I first saw the
I saw many questions asking 'how' to unit test in a specific language, but
I saw this in an answer to another question , in reference to shortcomings

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.