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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:24:43+00:00 2026-06-01T02:24:43+00:00

I am trying to make my iPhone app more robust, by ensuring that it

  • 0

I am trying to make my iPhone app more robust, by ensuring that it doesn’t crash when there is no network connection. Right now the app attempts to make a connection on startup immediately, through the app delegate. It has no issues if wifi or cellular is available, but it will crash if there is no network connection visible. I have looked around on this site and haven’t found anything that quite fits my problem. I have the feeling it should be just a simple line of code, like an objective-c equivalent of a pseudo- ‘isConnection’, or something similar:

if (isConnection) {
    - sendSynchronousRequest for json data I'm using
    - manipulate the data, etc., and continue with normal operations
} else {
    - send an output message to a view controller, 
      letting the user know what's wrong.
}

I can’t seem to isolate the (admittedly abstract) “isConnection” condition that I’m looking for, specifically. Does anyone have experience or advice with this topic?

  • 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-01T02:24:44+00:00Added an answer on June 1, 2026 at 2:24 am

    The reachability class is very easy to use. Download the class files here https://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html

    You also need to add the SystemConfiguration.framework

    Here’s the code you need:

    -(BOOL)isConnection {
        Reachability *reach = [Reachability reachabilityWithHostName:@"www.google.com"];
        //replace www.google.com with your own host you're checking for
        NetworkStatus hostStatus = [reach currentReachabilityStatus];
        if (hostStatus != NotReachable) {
            //There are also other status enums like
            //ReachableViaWiFi
            //ReachableViaWWAN (3G/LTE)
            //if you need to detect if user is on cellular, act accordingly
            return YES;
        }
        return NO;
    }
    

    Then you can call your method:

    if ([self isConnection]) {
        //do something
    } else {
        //no connection, inform user
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a general error handler for an iPhone app that brings
I am trying to make an iPhone-app that does the Monte Carlo simulation on
I am trying to make a basic iphone app that shows nearby tweets. I
have been trying couple of hours now to make my iphone app universal. The
I'm trying to make a very simple iphone app that displays the real-time camera
Like the topic title mentioned. I'm trying to make an app (for iPhone) that
I am trying to make an iPhone app that uses OpenCV plus another C++
In this iphone app I'm trying to make it so that when you select
I am trying to make this landscape only iphone app. I only use this
I'm a beginner level programmer trying to make a game app for the iphone

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.