reachability

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

南楼画角 提交于 2019-11-27 14:48:14
问题 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

git reflog expire and git fsck --unreachable

夙愿已清 提交于 2019-11-27 14:38:33
问题 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

Setting up reachability with AFNetworking 2.0

℡╲_俬逩灬. 提交于 2019-11-27 10:56:49
问题 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

Reachability airplane mode (3G) vs. Wifi

隐身守侯 提交于 2019-11-27 08:39:52
问题 I know the Reachability code will provide if the phone has access to Wifi or 3G network. However, if the phone has 3G on and Wifi, the Reachability code defaults to saying the phone has Wifi on and I can't detect if 3G network is enabled or not (airplane mode on or off). I need to find out specifically if 3G mode is on or off when Wifi is also on. Here is the code: Reachability *reachability = [Reachability reachabilityForInternetConnection]; [reachability startNotifier]; NetworkStatus status

How to check internet connection in alamofire?

泄露秘密 提交于 2019-11-27 06:55:23
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), method: method, parameters: parameters, encoding: encoding.value, headers: headers) .responseJSON { let resstr = NSString(data: $0.data!, encoding: String.Encoding.utf8.rawValue) print("error is \(resstr)") if $0.result.isFailure { self.failure("Network") print("API FAILED 4") return } guard let result = $0.result.value else { self.unKnownError() self.failure("") print("API FAILED 3") return } self

How to use NetworkReachabilityManager in Alamofire

被刻印的时光 ゝ 提交于 2019-11-27 04:02:55
问题 I want functionality similar to AFNetworking in Objective-C with Alamofire NetworkReachabilityManager in Swift: //Reachability detection [[AFNetworkReachabilityManager sharedManager] startMonitoring]; [[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) { switch (status) { case AFNetworkReachabilityStatusReachableViaWWAN: { [self LoadNoInternetView:NO]; break; } case AFNetworkReachabilityStatusReachableViaWiFi: { [self

iOS network reachability - doesn't seem to be working

时光总嘲笑我的痴心妄想 提交于 2019-11-27 03:34:28
问题 I'm following How to check for an active Internet connection on iOS or OSX? and http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html to test for connectivity, but am running into some pretty basic issues. For example, I'm running a .NET API off of another machine and then trying to connect to it via my mac mini. 1) When IIS is running, everything is working like it should, I was excited that I got this working! 2) I can shut off IIS completely (obviously,

How to get change in network connection notification from iOS Reachability Class?

风格不统一 提交于 2019-11-27 01:57:15
问题 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 didFinishLaunchingWithOptions method, Reachability* reachability = [Reachability reachabilityForInternetConnection]; [reachability startNotifier]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityChanged:) name:kReachabilityChangedNotification object:nil]; and my

Using Apple's Reachability to check remote server reachability in Swift

梦想与她 提交于 2019-11-27 01:52:24
问题 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 the HTTP server is online or not. Here's the code: ... let RemoteHost: String = "192.168.178.130" var RemoteReachability: Reachability! = nil var RemoteIsReachable: Bool = false init() { super.init() self.RemoteReachability = Reachability(hostName: self.RemoteHost) NSNotificationCenter

ASIHTTPRequest框架进行文件下载

北战南征 提交于 2019-11-26 21:03:57
一、在项目中使用 ASIHTTPRequest 1、拷贝源文件到项目中 ASIHTTPRequest 是一个开源项目,要使用他,直接拷贝项目源文件到你的项目 中,包括下列文件(即 Classes 下所有文件和 External/Reachability 下所有文 件): ASIHTTPRequestConfig.h ASIHTTPRequestDelegate.h ASIProgressDelegate.h ASICacheDelegate.h ASIHTTPRequest.h ASIHTTPRequest.m ASIDataCompressor.h ASIDataCompressor.m ASIDataDecompressor.h ASIDataDecompressor.m ASIFormDataRequest.h ASIInputStream.h ASIInputStream.m ASIFormDataRequest.m ASINetworkQueue.h ASINetworkQueue.m ASIDownloadCache.h ASIDownloadCache.m 对于 iPhone,还要拷贝下列文件: ASIAuthenticationDialog.h ASIAuthenticationDialog.m Reachability.h (External