reachability

Figure out if there is internet or not, including wifi or data (Swift 3) [closed]

雨燕双飞 提交于 2019-12-02 20:19:22
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I found a reachibility code online, unfortunately it only works for the wifi Network. I Need a code to determine if a person has an internet connection: this includes wifi and data. Any help is greatly appreciated! 回答1: You can use the Reachability framework. Install it through CocoaPods with pod

Need Reachability version for ARC in iOS5

安稳与你 提交于 2019-12-02 18:52:48
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 autorelease/retain and the NSAutoReleasePool . Undefined symbols for architecture armv7: "_SCNetworkReachabilityCreateWithAddress", referenced from: +[Reachability reachabilityWithAddress:] in Reachability.o "_SCNetworkReachabilityCreateWithName", referenced from: +[Reachability reachabilityWithHostName:] in Reachability.o "_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from: -[Reachability

iOS/iPhone Reachability - How to only check when internet is lost/not reachable using Reachability.m/.h

吃可爱长大的小学妹 提交于 2019-12-02 18:33:30
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 if i have a internet connection and then loose the network it tells me. However when you reconnect to the network it also tells me, which i do not want. I want it to only tell me when there is a loss/no network. I believe it has something to do with the call: - (void)viewWillAppear:(BOOL)animated { // check for internet connection [[NSNotificationCenter defaultCenter] addObserver:self selector:

Figure out if there is internet or not, including wifi or data (Swift 3) [closed]

半腔热情 提交于 2019-12-02 08:28:47
I found a reachibility code online, unfortunately it only works for the wifi Network. I Need a code to determine if a person has an internet connection: this includes wifi and data. Any help is greatly appreciated! You can use the Reachability framework. Install it through CocoaPods with pod 'ReachabilitySwift', '~> 3' . To use it: Declare a global variable: var reachability = Reachability()! Add an observer and start the notifier in your viewWillAppear : override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(true) NotificationCenter.default.addObserver(self, selector: #selector

How to return BOOL when checking internet connection in XCODE

北城以北 提交于 2019-12-02 01:40:41
I want to be able to check for internet connectivity when my View loads. To predetermine the contents of my view. I have the following viewDidLoad method: - (void)viewDidLoad { [super viewDidLoad]; if(![self hasInternetConnection]){ NSLog(@"SHOW ORIGINAL DOC"); } else{ NSLog(@"SHOW NEW DOC"); } } And I have a method called hasInternetConnection as follows: - (BOOL)hasInternetConnection{ NSLog(@"Starting connection test"); internetReachableFoo = [Reachability reachabilityWithHostname:@"www.google.com"]; // Internet is reachable internetReachableFoo.reachableBlock = ^(Reachability*reach){ //

reachabilityWithAddress is not working in Objective C programming

淺唱寂寞╮ 提交于 2019-12-02 01:06:46
问题 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 = htons(80); address.sin_addr.s_addr = inet_addr("74.125.71.104");` Reachability *reach = [Reachability reachabilityWithAddress:&address]; but those not working. When I change to reachabilityWithHostname , it's working. 回答1: Please import #include <arpa/inet.h>

iOS check if cellular technology available even if the device is on WiFi

女生的网名这么多〃 提交于 2019-12-01 22:15:50
问题 Need some help here. I need to detect if an iOS device have (on a certain moment) cellular capabilities (No matter which one). I tried to use reachability class, but the problem start when the user is connected to WiFi, because if so - reachability can't detect cellular I also tried to use this code: CTTelephonyNetworkInfo *telephonyInfo = [CTTelephonyNetworkInfo new]; NSLog(@"Current Radio Access Technology: %@", telephonyInfo.currentRadioAccessTechnology); [NSNotificationCenter

reachabilityWithAddress is not working in Objective C programming

守給你的承諾、 提交于 2019-12-01 21:05:46
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 = htons(80); address.sin_addr.s_addr = inet_addr("74.125.71.104");` Reachability *reach = [Reachability reachabilityWithAddress:&address]; but those not working. When I change to reachabilityWithHostname , it's working. Please import #include <arpa/inet.h> [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityChanged:) name

IOS Reachability notification in Background

只愿长相守 提交于 2019-12-01 18:42:22
I want to do some tasks as soon as user comes online even he is in background. I am using Reachability class for checking internet. But this class is not notifying me when i am at background. I know people asked this question earlier but didn't got any solutions there. If i use beginBackgroundTaskWithExpirationHandler . It gives me 3 to 4 min only, after that if network change i am not getting any notification. Please suggest me something.I think it is possible because native mail app work in that manner and my app support iOS7 only. You cannot get notification form your classes while the app

Check Internet connection availability?

天大地大妈咪最大 提交于 2019-12-01 15:55:24
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 done some research and found this stackoverflow LINK in objective C. Therefore I just tried to find a similar solution in SWIFT and found the following link https://coderwall.com/p/mhxbpq/checking-for-internet-connection-availability Just to make things easy the content in that link is as follows... import Foundation import SystemConfiguration public class Reachability { class func