Saturday, 15 February 2014

Reachability iOS doesn't work fine -


We are developing a module that checks whether the Internet connection is either active or not active or disabled. The previous circumstances work well, except for the case if there is a Wi-Fi connection but the Internet is not active. We have ensured that data is not mobile connection (3G, 4G) enabled.

We have seen that everyone recommends using Tony Millennial's Ability Class, which is the place of one of the applets.

Below, we are using that code:

  - (BOOL) Application: (UIApplication *) Application given FinishLaunchingWithOptions: (NSDictionary *) launchOptions {Reachability * = [Reachability AccessibilityHostname: @ "www.google.com"]; // Cambiar por el servidor reachability.reachableBlock = ^ (Accessibility * Accessibility) {NSLog (@ "Network is accessible."); }; Reachability.unreachableBlock = ^ (Qualification * Accessibility) {NSLog ("Network" is not accessible.); }; // Start monitoring [Accessibility StartNotifier]; Yes come back }  

Is there a Wi-Fi connection but the Internet is not active, it does not work because it is the following:

  reachability.reachableBlock = ^ ( Accessibility * Accessibility) {NSLog (@ "Network is accessible."); }  
  reachability.unreachableBlock = ^ (Accessibility * Accessibility) {NSLog (@ "Network is unreachable.") Instead of  

;); Class = "post-text" itemprop = "text">

Try it out,

  - (BOOL) isnate available {BOOL isNetAvailable = NO; Reachability * Access = [Rebility Accessibility] Withhostname: @ "www.google.com"]; Netwertus netstatus = [reaching current retraceability stats]; If (netstats! = Not writable) {isNetAvailable = YES; } Else {isNetAvailable = NO; } Return henat is available; }  

No comments:

Post a Comment