reachability

Are there more sophisticated alternatives to Apples Reachability class?

安稳与你 提交于 2019-11-29 08:00:44
Apple has created that famous Reachability class but looking at the code I don't trust it much. The formatting and header is messy. Also it provides no help for showing that "You have no internet!" alert. I just want to do: At some point download a XML. When there is no internet, show alert. When internet disconnects while downloading the XML, show alert. In my app the user taps no download button it all happens automatically in the background. That's it. Really. I spent now 3 hours with Reachability my brain just rejects it. Did someone create a clever alternative with a clean header and

SCNetworkReachabilityGetFlags returns 0 even when wireless available

空扰寡人 提交于 2019-11-29 07:42:31
I have an app that uses Apples reachability code. When I tab out of the app, turn on airplane mode, go back into the app, I correctly get a message that says no connection is available. If I go back out turn OFF airplane mode and go back into the app, I STILL get the message that no connection is available. The specific problem code is this: NetworkStatus status = kNotReachable; if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) { status = [self networkStatusForFlags: flags]; return status; } I get inside the if statement and flags ends up being 0 (

How to detect change in network with Reachability?

爱⌒轻易说出口 提交于 2019-11-29 06:49:58
I'm currently checking network connection on viewDidLoad using this: -(BOOL)reachable { ReachabilityDRC *r = [ReachabilityDRC reachabilityWithHostName:@"google.com"]; NetworkStatus internetStatus = [r currentReachabilityStatus]; if(internetStatus == NotReachable) { return NO; } return YES; } But I also want to be notified if there is a change of network, such as wifi dropped, or wifi is back, so I can make changes accordingly. How can I adjust my method to do something like that? Reno Jones Another possible solution is to add a NS Notification in "application didfinishlaunching": [

Reachability Notification Never Called

谁说我不能喝 提交于 2019-11-29 00:15:58
I am having a hard time using Reachability in my code. I would like to keep it very simple by initiating an observer at launch and then just receiving change notifications. In the following code, the reachabilityChanged method is never called. I’ve tried many iterations but this is the simplest version. It compiles and runs. Please help... ** * * AppDelegate.h code * ** * #import <UIKit/UIKit.h> #ifdef PHONEGAP_FRAMEWORK #import <PhoneGap/PGViewController.h> #import <PhoneGap/PGURLProtocol.h> #import <PhoneGap/Reachability.h> #else #import "PGViewController.h" #import "PGURLProtocol.h" #import

How to check internet connection on iOS device? [duplicate]

放肆的年华 提交于 2019-11-28 23:31:03
This question already has an answer here: How to check for an active Internet connection on iOS or macOS? 42 answers 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 there is internet on the device or not. I tried to look over the internet all that I see is that they check if the website is reachable or not using the Rechability class. I want to check if the user has internet or not when he opens my application. I'm using Xcode6 with Objective-C

git reflog expire and git fsck --unreachable

a 夏天 提交于 2019-11-28 23:15:53
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, and I know you do too). So I was playing with git, trying to expire an amended commit. My reflog looks like that: 4eea1cd HEAD@{0}: commit (amend): amend commit ff576c1 HEAD@{1}: commit: test: bar 5a1e68a HEAD@{2}: commit: test: foo da8534a HEAD@{3}: commit (initial): initial commit Which means I made two commits ( da8534a and 5a1e68a ), then a third commit ff576c1 that I amended with 4eea1cd .

Detect the reachability in background

余生长醉 提交于 2019-11-28 21:17:43
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 http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html But this code doesn´t notify internet state when the App it´s in background. So I tried also the folowing code and it work when App is launched from Background state to foreground (same as Apple reachability sample code) - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:

How to get Reachability Notifications in iOS in Background when dropping Wi-Fi network?

橙三吉。 提交于 2019-11-28 19:01:31
问题 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 running, but rather the following. My AppDelegate handles the Reachability stuff. The app receives notifications ( kReachabilityChangedNotification ) while the app is running, and when the app is in the Background ( applicationDidEnterBackground: ). The app is designed to reload a playing audio stream

Setting up reachability with AFNetworking 2.0

╄→尐↘猪︶ㄣ 提交于 2019-11-28 17:58:04
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 in the relevant VC method I check to see if isReachable: // Double check with logging if ([[AFNetworkReachabilityManager sharedManager] isReachable]) { NSLog(@"IS REACHABILE"); } else { NSLog(@"NOT REACHABLE"); } At present this is not working as expected in the simulator, but I imagine this would need to be tested on device and not simulator. Question What I would like to do is monitor the

Swift 2.0 NSURLConnection sendSynchronousRequest

ぃ、小莉子 提交于 2019-11-28 13:04:49
I am using the code below to check for an internet connection. It was working correctly but after the Swift 2.0 update I now see an error on the line var data = NSURLConnection.sendSynchronousRequest(request, returningResponse: &response, error: nil) as NSData? saying extra argument 'error' in call. class func isConnectedToNetwork()->Bool{ var Status:Bool = false let url = NSURL(string: "http://google.com/") let request = NSMutableURLRequest(URL: url!) request.HTTPMethod = "HEAD" request.cachePolicy = NSURLRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData request.timeoutInterval = 10.0