Questions tagged [reachability]
Reachability is an iOS sample application which demonstrates how to use the SystemConfiguration framework to monitor the network state of an iPhone or iPod touch. In particular, it demonstrates how to know when IP can be routed and when traffic will be routed through a Wireless Wide Area Network (WWAN) interface such as EDGE or 3G.
reachability
853
questions
1408
votes
39
answers
514k
views
How can I check for an active Internet connection on iOS or macOS?
I would like to check to see if I have an Internet connection on iOS using the Cocoa Touch libraries or on macOS using the Cocoa libraries.
I came up with a way to do this using an NSURL. The way I ...
316
votes
31
answers
356k
views
Check for internet connection with Swift
When I try to check for an internet connection on my iPhone I get a bunch of errors. Can anyone help me to fix this?
The code:
import Foundation
import SystemConfiguration
public class Reachability ...
151
votes
16
answers
144k
views
Easiest way to detect Internet connection on iOS?
I know this question will appear to be a dupe of many others, however, I don't feel the simple case is well explained here. Coming from an Android and BlackBerry background, making requests through ...
110
votes
11
answers
93k
views
iOS Detect 3G or WiFi
I am not sure if this is possible, but I have this scenario.
I have a website displayed in my UIWebView which has the link set in a UISegmentedController.
They website can detect if you are on wifi ...
103
votes
8
answers
48k
views
How to use SCNetworkReachability in Swift
I'm trying to convert this code snippet to Swift. I'm struggling on getting off the ground due to some difficulties.
- (BOOL) connectedToNetwork
{
// Create zero addy
struct sockaddr_in ...
45
votes
11
answers
77k
views
Detecting Network Connectivity Changes using Reachability, NSNotification and Network Link Conditioner in Swift
From iOS 12 you simply use NWPathMonitor which is a line of code (example).
For historic purposes:
I'm trying to integrate network connectivity detection into my app, however it seems that somewhere ...
43
votes
3
answers
31k
views
Reachability Guide for iOS
Has anyone found a halfway decent guide to implementing Reachability on iOS?
41
votes
9
answers
47k
views
How to check internet connection in alamofire?
I am using below code for making HTTP request in server.Now I want to know whether it is connected to internet or not. Below is my code
let request = Alamofire.request(completeURL(domainName: path)...
39
votes
5
answers
67k
views
iPhone reachability checking
I've found several examples of code to do what I want (check for reachability), but none of it seems to be exact enough to be of use to me. I can't figure out why this doesn't want to play nice.
I ...
37
votes
3
answers
38k
views
How to use iOS Reachability
I'm developing an iPhone app that uses the network. The iPhone communicate with my server via HTTP request and should work on WiFi and 3G.
I currently use NSURLConnection initWithRequest to send async ...
33
votes
11
answers
44k
views
How to use NetworkReachabilityManager in Alamofire
I want functionality similar to AFNetworking in Objective-C with Alamofire NetworkReachabilityManager in Swift:
//Reachability detection
[[AFNetworkReachabilityManager sharedManager] startMonitoring];...
32
votes
8
answers
23k
views
Need Reachability version for ARC in iOS5
Using Apple's Reachability code in iOS5 I get a bunch of compilation errors as shown below. Any ideas on what is happening here? I'm using ARC so I have edited the standard code slightly to remove ...
29
votes
2
answers
1k
views
Why is Promise<never> not considered in reachability analysis?
Assume we have this function:
function returnNever(): never {
throw new Error();
}
When creating an IIFE, the code that comes after it becomes marked as unreachable:
(async () => {
let b: ...
24
votes
2
answers
23k
views
How to get Reachability Notifications in iOS in Background when dropping Wi-Fi network?
I'm using Reachability successfully to determine the status of the network, and to be notified of changes (e.g. Reachability Guide for iOS 4).
My question isn't how to get Reachability up and ...
20
votes
1
answer
6k
views
git reflog expire and git fsck --unreachable
Disclaimer: this question is purely informational and does not represent an actual problem I'm experiencing. I'm just trying to figure out stuff for the sake of it (because I love figuring stuff out, ...
20
votes
2
answers
7k
views
Detect the reachability in background
I have been testing different way to implement the possibility to know if the device get internet back when the app it is in background so the first code I test was the Apple reachability sample code ...
20
votes
6
answers
25k
views
Could not successfully update network info during initialization
I get the above mentioned issue all the time when I first launch the app in the day.
When I first launch the app, I make server calls to get some data and then play animation video. Server calls is ...
19
votes
3
answers
34k
views
AFNetworking checking Availability
I've implemented AFNetworking without subclassing AFHTTPClient, in part using the following code in my DownloadQueueManager:
-(void)downloadPodcastAt:(NSString *)url toPath:(NSString *)path
{
...
18
votes
2
answers
8k
views
Reachability and IPv6
One of my project uses the Apple's Reachability class in order to be monitor the network state and be notified in case of changes.
After reading this article about supporting IPv6 I was wondering if ...
17
votes
4
answers
21k
views
Using Apple's Reachability to check remote server reachability in Swift
I'm developing an iOS application written in Swift that communicates with a HTTP server on the local network, and I'm using Apple's Reachability class to determine wether the remote machine running ...
17
votes
4
answers
29k
views
Setting up reachability with AFNetworking 2.0
I am trying to setup Reachability using the new 2.0 AFNetworking.
In my AppDelegate I initialise the sharedManager.
// Instantiate Shared Manager
[AFNetworkReachabilityManager sharedManager];
Then ...
16
votes
3
answers
34k
views
How to detect Network Signal Strength in iOS Reachability
I am creating a new Traveling Application in iOS, this application is highly dependent on Maps and will include two Maps.
My first Map will work when the user has a strong Network Signal (Apple ...
16
votes
6
answers
9k
views
Reachability not working as expected
Downloaded Reachability from Apple, using this method to check for an active connection:
-(BOOL)isReachable{
Reachability *r = [Reachability reachabilityWithHostName:@"http://www.google.com"];
...
15
votes
7
answers
32k
views
How to use reachability class to detect valid internet connection?
I'm new to iOS development and am struggling to get the reachability.h class to work. Here is my code for view controller:
- (void)viewWillAppear:(BOOL)animated
{
[[NSNotificationCenter ...
15
votes
10
answers
47k
views
How to check internet connection on iOS device? [duplicate]
I'm wondering how I can check if the user is connect to internet through WIFI or cellular data 3G or 4G.
Also I don't want to check if a website is reachable or not, the thing that I want to check if ...
14
votes
5
answers
5k
views
ios: Queue blocks in background and execute when network becomes available
I am developing an app using parse.com API (hosted backend which provides API to save data on their servers). I want to be able to use the app seamlessly online and offline.
For this I would need to ...
13
votes
5
answers
19k
views
How to get change in network connection notification from iOS Reachability Class?
Hi I want to capture whenever user gets a network connectivity in my application for this I have added apples Reachability class and below is the snippet I am using in my appDelegate class ...
12
votes
3
answers
17k
views
Best Approach For Checking Internet Connection in iOS
I have been searching through internet to find the best way to check for internet connection in iOS that works for both in IPv4 and IPv6 network environment. I found there are many possible answers ...
12
votes
4
answers
2k
views
Can I prevent iPhone from using 3G under any circumstances?
I'm writing a travel guide related app that will download large databases (60meg) potentially overseas, with the reachability code I can tell when a host is reachable via wifi or 3g BUT I'm worried ...
12
votes
3
answers
5k
views
How do I know whether my iPhone/iPad is connected to 2G or 3G? [duplicate]
I was trying to check wether the device is connected via 2G (GPRS, EDGE) or 3G (UMTS, HSDPA).
I only found the Reachability example class from here (Apple Dev Example)
This example only check wether ...
11
votes
4
answers
12k
views
Using Reachability for Internet *or* local WiFi?
I've searched SO for the answer to this question, and it's not really addressed, at least not to a point where I can make it work.
I was originally only checking for Internet reachability, using:
...
11
votes
2
answers
6k
views
Reachability not working when wi-fi connected but no internet
I am using Apple's reachability code, and am setting up both initial notifications on when network reachability changes and prior to initiating a server connection. The code works when I am on wi-fi ...
10
votes
1
answer
2k
views
Updating iPhone Reachability on Network Changes
Edit 23.5.11
I'm now wondering whether I'm over engineering this. When I use an online connection, I handle it properly - either:
in the background with a progress or activity indicator showing and ...
10
votes
7
answers
35k
views
iOS/iPhone Reachability - How to only check when internet is lost/not reachable using Reachability.m/.h
Currently i am using the class by apple reachability.m/.h and it works, except it notifies me for any change, where as i would like to only notify the user if the network is not reachable. Currently ...
10
votes
1
answer
838
views
How to detect at realtime the increase/decrease of cellular signal power in iOS
My app (it is an app store app) is able to connect via 3G/4G/LTE/Edge etc... however it cannot detect at realtime (via a callback perhaps) that the strength of the signal have been modified. For ...
10
votes
1
answer
2k
views
Testing Reachability with Network Link Conditioner on 100% packet loss: help me understand what's happening
Help me understand what I am seeing when testing Reachability code using the Network link conditioner. Here is my vanilla Reachability code:
Reachability* wifiReach = [[Reachability ...
10
votes
1
answer
3k
views
tony million Reachability says unreachable when connected
I have searched but have not found an issue like mine.
I'm sure it's something I have over looked .
I am using tony million's reachability block method.
it is working good when i have internet then ...
10
votes
1
answer
3k
views
Include non-modular header inside framework module with Allow non-modular includes set to YES
Background
I'm building an API framework in Swift. I want it to include a Reachability class that can be used internally and externally.
Status
I've copied the source of the Reachability class ...
9
votes
4
answers
6k
views
Check Internet connection availability?
I just need to check the internet connection availability before start communicating with the service in my iphone App. I am using Swift 1.2 and Xcode 6 as my development environment...
I've just ...
9
votes
1
answer
5k
views
Should I listen for reachability updates in each UIViewController?
I see a lot of Reachability examples where people only display a message when reachability status changes.
But recently, I saw in Foursquare app that they display a message every time the user try to ...
9
votes
1
answer
12k
views
iOS Detecting connection speed or type [duplicate]
Possible Duplicate:
Iphone detect 3g or wifi
is there a way to get the current network speed or if the device is on EDGE/3G/GPRS?
I can use Reachability to distinguish WiFI from WMAN but that's ...
9
votes
2
answers
5k
views
Reachability issue on iPhone: networkStatusForFlags
I'm doing a few server calls and getting back some json. The code is pretty simple, it does a call to sign you in, and then does another call to get more info. I keep getting Reachability errors when ...
9
votes
3
answers
5k
views
Swift, Check if particular website reachable
How to check reachability of particular website?
I am connected to wifi network for internet access, which have blocked some sites. How to check if I have access to those sites or not?
I have ...
9
votes
1
answer
7k
views
kReachabilityChangedNotification is called multiple times
I'm using the Reachability classes for checking when I got an internet connection en when it goes down.
This is my code:
IN VIEW DID LOAD:
internetReachable = [Reachability ...
8
votes
3
answers
9k
views
checking reachability against a specific page in a URL
After I have read the answer for this question I have found that using reachabilityWithHostName does not work with a URL such as this one: mySite.com/service.asmx , is there anyway to check ...
8
votes
3
answers
30k
views
Unity check internet connection availability
I am porting our game to Unity, and need some help regarding internet connectivity check in Unity.
Official Unity Documentation says 'do not use Application.internetReachability.
So i am confused ...
8
votes
1
answer
6k
views
Reachability vs NSURLSession response to detect internet connection
I'm building out error cases for my API calls and would like to check for a condition when an internet connection in not available.
dataTaskWithRequest seems to handle this just fine and returns an ...
8
votes
3
answers
8k
views
How to detect change in network with Reachability?
I'm currently checking network connection on viewDidLoad using this:
-(BOOL)reachable {
ReachabilityDRC *r = [ReachabilityDRC reachabilityWithHostName:@"google.com"];
NetworkStatus ...
8
votes
4
answers
876
views
guaranteed delivery for uploads after network reconnect, even if my app is not running
I'm spec-ing an iOS app (which will be built outside of our company) which will upload a user's data entry to a server. If the device is not connected to the Internet, we'd like to save data on the ...
8
votes
3
answers
7k
views
How to detect loss of internet reachability when wifi source loses connection?
I am trying hard to get the authentic internet connectivity status. I have used Apple's Reachability but it's only giving me the status of wifi connectivity i.e. not covering the case when the device ...