Need Reachability version for ARC in iOS5
I wrote a clean ‘drop in’ version of reachability for ARC and iOS5 – you can get it here: https://github.com/tonymillion/Reachability
I wrote a clean ‘drop in’ version of reachability for ARC and iOS5 – you can get it here: https://github.com/tonymillion/Reachability
Reachability is a network helper utility class, its used to get various informations about the connection status What is the main purposes of Reachability? Reachability is used to query the network status, and to register your listeners to get informed when connectivity changes. Is this the main purpose of Reachability, to show the user a … Read more
From your screen shot, it seems like you do not have Reachability added to your project. You must download Reachability from Apple: https://developer.apple.com/library/content/samplecode/Reachability/Introduction/Intro.html And add both .h and .m files to your project. Update: You noted you have Reachability. But looking at the most recent version, I can see why you have the errors you … Read more
For swift 5 and Alamofire 5.4.4 ,I created a swift class called Connectivity . Use NetworkReachabilityManager class from Alamofire and configure the isConnectedToInternet() method as per your need. import Foundation import Alamofire class Connectivity { class func isConnectedToInternet() -> Bool { return NetworkReachabilityManager()?.isReachable ?? false } } Usage: if Connectivity.isConnectedToInternet() { print(“Yes! internet is available.”) … Read more
Using the code that Apple has provided here Reachability *reachability = [Reachability reachabilityForInternetConnection]; [reachability startNotifier]; NetworkStatus status = [reachability currentReachabilityStatus]; if(status == NotReachable) { //No internet } else if (status == ReachableViaWiFi) { //WiFi } else if (status == ReachableViaWWAN) { //3G }
You must create a Reachability object before you can receive notifications from it. Also, be sure to call the startNotifier() method on the Reachability object you create. This would be an example of how to do so inside of your application delegate: class AppDelegate: UIResponder, UIApplicationDelegate { private var reachability:Reachability!; func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: … Read more
I have implemented Reachability like this. Download https://developer.apple.com/library/content/samplecode/Reachability/Introduction/Intro.html and add Reachability.h and .m to your project. Add the SystemConfiguration framework to your project. #import “Reachability.h” where you want to use it. Use this code. -(BOOL)reachable { Reachability *r = [Reachability reachabilityWithHostName:@”enbr.co.cc”]; NetworkStatus internetStatus = [r currentReachabilityStatus]; if(internetStatus == NotReachable) { return NO; } return YES; … Read more
(This answer was extended repeatedly due to changes in the Swift language, which made it a bit confusing. I have now rewritten it and removed everything which refers to Swift 1.x. The older code can be found in the edit history if somebody needs it.) This is how you would do it in Swift 2.0 … Read more
I did a little more research and I am updating my answer with a more current solution. I am not sure if you have already looked at it but there is a nice sample code provided by Apple. Download the sample code here Include the Reachability.h and Reachability.m files in your project. Take a look … Read more