title: Prevent AFNetworking Reachability Status Getting Called at First Launch for iOS
body: <p>I just want to know how to prevent my alert view from appearing everytime I open my application that's already connected to the internet. I'm using ARC if that helps.</p>
  
  <p>This is the code I have in my didFinishLaunchingWithOptions method inside my AppDelegate:</p>
  
  <pre><code>__weak id myself = self; // to silence warning for retain cycle
  _httpClient = [AFHTTPClient clientWithBaseURL:[NSURL URLWithString:@"http://apple.com"]];
      [_httpClient setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
          switch (status) {
              case AFNetworkReachabilityStatusNotReachable:
              {
                  // Not reachable
                  NSLog(@"Not connected to the internet");
                  UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Not connected to the internet" delegate:myself cancelButtonTitle:nil otherButtonTitles:@"Dismiss", nil];
                  [alert show];
  
                  break;
              }
              case AFNetworkReachabilityStatusReachableViaWiFi:
              {
                  NSLog(@"Connected to the internet via WiFi");
                  UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Connected to the internet via WiFi" delegate:myself cancelButtonTitle:nil otherButtonTitles:@"Dismiss", nil];
                  [alert show];
  
                  break;
              }
              case AFNetworkReachabilityStatusReachableViaWWAN:
              {
                  NSLog(@"Connected to the internet via WWAN");
                  UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Connected to the internet" delegate:myself cancelButtonTitle:nil otherButtonTitles:@"Dismiss", nil];
                  [alert show];
  
                  break;
              }
              default:
                  break;
          }
      }];
  </code></pre>