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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:24:05+00:00 2026-05-25T03:24:05+00:00

I have read this question and found its answer to be useful to check

  • 0

I have read
this question and found its answer to be useful to check an internet connection for the iPhone. I implemented the check in my viewDidLoad message.
However my App does load Data from an XML file from a server (within viewWillAppear). In this case the check has to be done before the app tries to load the data from the internet source. My problem here is that the network check requires some seconds but the app does proceed with the code.
This results in delaying the check. So there is a valid internet connection, but the bool variable that stores this information is set too late.

Code in viewDidLoad

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(checkNetworkStatus:) name:kReachabilityChangedNotification object:nil];
internetReachable = [[Reachability reachabilityForInternetConnection] retain];
[internetReachable startNotifier];

The selected message is implemented in the same way like in the example in the link above. Additionally it sets some bool-properties so I can access the connection state within the app.

Code in viewWillAppear

if(internetActive == TRUE)
{
    NSLog(@"connected");
    //Code to load XML stuff
}
else
{
    NSLog(@"not connected");
}

The console shows me "not connected". But a few seconds later the debug logs within "checkNetworkStatus" show me that the internet connection is available and the bool "internetActive" would be set.
I assume that the network check delivers his report about the connection state too late for my purpose. Is there a way to delay the app until the connection is established? Or would this lead to crashing the app cause the view isn’t displayed within a few seconds?
Are there any other possibilities to ensure the connection?

My second question is how to ensure a specific internet address is available? I the link above there is mentioned

    hostReachable = [[Reachability reachabilityWithHostName: @"www.apple.com"] retain];
    [hostReachable startNotifier];

to detect the connection to a host, but I want to go in detail and try to detect if the host deserves a specific address or not. But entering the full address path (e.g. "localaddress.mylan.de/lan/xml/") instead of the host leads to a not reachable connection state for the host. Entering the mentioned address in the browser address bar shows me the correct result. I guess I have to check it otherwise but how?

Thanks for reading 🙂

  • 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-25T03:24:05+00:00Added an answer on May 25, 2026 at 3:24 am

    After getting more experiences with IOS development my first question is solved with three steps.

    1. First step is to start all necessary notifiers once. This can be done by starting them in viewDidLoad of the first loaded ViewController.
    2. Check current connection state by evaluating property named currentReachabilityStatus of reachability-objects. This state can be “not connected” even if a connection is available. This happens if the check is done within the ViewController who is starting the notifier. Reason for this is the time it takes while the notifier recognizes the connection. If currentReachabilityStatus property is evaluated as connected then data loading processes can be started.
    3. Evaluating the connection state within the method whose selector is added during adding the notifier. This method will start every time the connection state changes. First call will be directly after starting the notifier. If connection state is evaluated as connected then data loading processes can be started.

    The second question stays unresolved up to now. May be there is no way other than sending a request to the target and waiting for a response or a timeout.

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

Sidebar

Related Questions

I have read this question but it's not quite what I was looking for.
I was reading this question (which you do not have to read because I
First let me say I have read this useful article thoroughly and am using
I have searched internet and stackoverflow thoroughly, but I haven't found answer to my
I have read this post about how to test private methods. I usually do
I have read this article from High Scalability about Stack Overflow and other large
I have read this article about 400% boost of your website . This is
I have read this. Jquery checkbox <input type=checkbox name=checkGroup id=all> <input type=checkbox name=checkGroup id=one
I have read over this which sort of gives an explanation of when you'd
Possible Duplicate: What’s with the love of dynamic Languages I have already read this

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.