AFNetworking comes with the
AFNetworkReachabilityManager
class that makes it very easy to detect the network connection type of the device our application is running on and also notifies us if the connection type changes. This can come in handy if we are creating an application that is heavily reliant on the Internet or has large downloads/uploads that we want to run only when connected to Wi-Fi.
Let's create our reachability client by using the following code:
AFNetworkReachabilityManager *reachability = [AFNetworkReachabilityManager sharedManager]; [reachability setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) { switch (status) { case AFNetworkReachabilityStatusReachableViaWWAN: NSLog(@"----Connection WWAN"); break; case AFNetworkReachabilityStatusReachableViaWiFi:...