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 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.

856 questions
3
votes
2 answers

Internet connection status swift reachability

I have the following code to determine whether if there is an internet connection or no. This code works fine. How Can I know if I suddenly lost the connection var reachability:Reachability? reachability = Reachability() self.reachability =…
Ahmed
  • 1,229
  • 2
  • 20
  • 45
3
votes
1 answer

Reachability vs UIDevice-Reachability

I need to test network reachability in my iPhone project. Which project is better to use? Reachability vs UIDevice-Reachability
m88m
  • 33
  • 3
3
votes
6 answers

Is it wise to use Reachability to check for a remote host's availability?

Is it wise to use Reachability Class(from Apple) to check for a remote host's availability ? say for example, www.google.com or should I use NSString *connectedString = [[NSString alloc] initWithContentsOfURL:[NSURL…
Mithun John Jacob
  • 193
  • 1
  • 3
  • 16
3
votes
1 answer

Swift: How to check if my app has WLAN permission and the device is connected to a WIFI source?

I'm developing an app in which I need to know: Does my app has the permission to access WLAN network. Is the device currently connected to a WIFI. I know you can use Reachability to check if the device is connected to the internet, but it return…
guocongyu
  • 133
  • 1
  • 8
3
votes
2 answers

Do something after WKWebView has finished loading and scraping specific page

what I'm trying to do is perform an action only after the WKWebView I'm using has finished loading and scraping the page. Here's the code for the webView: let webView = WKWebView() let url = URL(string:…
Albifer
  • 167
  • 2
  • 10
3
votes
1 answer

How can kSCNetworkReachabilityFlagsIsWWAN be true and kSCNetworkReachabilityFlagsReachable be false

In iOS reachability, synchronously checking the SCNetworkReachabilityFlags and getting a combination of flags which are: kSCNetworkReachabilityFlagsReachable: 0 kSCNetworkReachabilityFlagsIsWWAN: 1 According to Apple's documentation (but also the…
Tim Diggins
  • 4,364
  • 3
  • 30
  • 49
3
votes
0 answers

Receive notifications that the connection has changed radioAccesstype between 3G, 2G or 4G in iOS

Want to implement a listener which will receive notifications on bearer changes, i.e. when the connection switches from 4G to 3G or 2G and vice-versa. Also when the network provider changes, e.g. when the device is in roaming, it may change provider…
Shane D
  • 834
  • 9
  • 23
3
votes
1 answer

Swift handle slow internet connection

I am using Reachability to handle internet connection. Whenever the internet is not connected i show the alert of not connected to internet. However, when the internet speed is slow and when pulling the data from API takes more than 10 seconds, i…
Rupesh Jaiswal
  • 93
  • 1
  • 1
  • 9
3
votes
1 answer

iPhone SDK reachabilityWithAddress issue

I need to check connectivity with IP address only. I'm trying to do it with Apple Reachability class, using reachabilityWithAddress option. And my problem is I can put any IP address in callAddress.sin_addr.s_addr field and statusText always will be…
MoriQuessir
  • 45
  • 1
  • 3
3
votes
3 answers

How to check internet connection in Swift 3 or Swift 4?

I have tried checking internet connection in Swift 3 but the code is not working for me. class func isConnectedToNetwork() -> Bool { var zeroAddress = sockaddr_in(sin_len: 0, sin_family: 0, sin_port: 0, sin_addr: in_addr(s_addr: 0), sin_zero:…
TechChain
  • 8,404
  • 29
  • 103
  • 228
3
votes
2 answers

Where should I perform a Reachability check?

I want to check for a valid network connection. I followed Apple's Reachability example and put my check in applicationDidFinishLaunching #pragma mark - #pragma mark Application lifecycle - (BOOL)application:(UIApplication *)application…
Sheehan Alam
  • 60,111
  • 124
  • 355
  • 556
3
votes
1 answer

Cannot invoke initializer for type 'UnsafeMutablePointer'

I'm trying to update Reachability.swift to swift 3.0 and I'm having trouble passing the Reachability instance to the call back function. Here is my snippet: * please note self = Reachability class var context = SCNetworkReachabilityContext(version:…
the Reverend
  • 12,305
  • 10
  • 66
  • 121
3
votes
6 answers

Detecting internet connectivity continually

I want my app to detect the internet connection loss automatically. So im using the following code. - (void)applicationDidBecomeActive:(UIApplication *)application { Reachability *networkReachability = [Reachability…
user6517192
3
votes
1 answer

reachabilityWithAddress is not working in Objective C programming

I want to check a server is live or not with ip, for example, 74.125.71.104 (Google's ip) // allocate a reachability object `struct sockaddr_in address; address.sin_len = sizeof(address); address.sin_family = AF_INET; address.sin_port =…
3
votes
1 answer

XCTestCase with internet connection case

I'm writing an app that has separated functions when online and offline. In those function, I use Reachability to check internet connection and with each case (online/offline), it does different works. Now, I've been required to write test cases for…
Eddie
  • 1,903
  • 2
  • 21
  • 46