title: Crash on Reachability API
body: <p>Below is the crash log I got: </p>
  
  <pre><code>Thread 0 name:  Dispatch queue: com.apple.main-thread
  Thread 0:
  0   libsystem_kernel.dylib          0x398d6f04 semaphore_wait_trap + 8
  1   libdispatch.dylib               0x3980f82a _dispatch_semaphore_wait_slow + 178
  2   libxpc.dylib                    0x3992668a xpc_connection_send_message_with_reply_sync + 150
  3   SystemConfiguration             0x33539850 _reach_server_target_status + 976
  4   SystemConfiguration             0x3353a27a __SCNetworkReachabilityServer_targetStatus + 38
  5   SystemConfiguration             0x3351a952 __SCNetworkReachabilityGetFlags + 318
  6   SystemConfiguration             0x3351b318 SCNetworkReachabilityGetFlags + 212
  7   AppName                         0x000e8830 -[Reachability currentReachabilityStatus] (Reachability.m:261)
  8   AppName                         0x0011f168 -[CommonClass checkNetworkStatus] (CommonClass.mm:3917)
  9   AppName                         0x0011f6a0 -[CommonClass isNetworkReachable] (CommonClass.mm:3974)
  10  AppName                         0x000d55de -[AppDelegate applicationWillEnterForeground:] (USyncAppDelegate.m:196)
  11  UIKit                           0x336f52ba -[UIApplication _sendWillEnterForegroundCallbacks] + 90
  12  UIKit                           0x336f4ee2 -[UIApplication _handleApplicationResumeEvent:] + 1090
  13  UIKit                           0x3354cd54 -[UIApplication handleEvent:withNewEvent:] + 1288
  14  UIKit                           0x3354c6c8 -[UIApplication sendEvent:] + 68
  15  UIKit                           0x3354c116 _UIApplicationHandleEvent + 6150
  16  GraphicsServices                0x3524f5a0 _PurpleEventCallback + 588
  17  CoreFoundation                  0x31719680 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 12
  18  CoreFoundation                  0x31718ee4 __CFRunLoopDoSources0 + 208
  19  CoreFoundation                  0x31717cb2 __CFRunLoopRun + 642
  20  CoreFoundation                  0x3168aeb8 CFRunLoopRunSpecific + 352
  21  CoreFoundation                  0x3168ad44 CFRunLoopRunInMode + 100
  22  GraphicsServices                0x3524e2e6 GSEventRunModal + 70
  23  UIKit                           0x335a02fc UIApplicationMain + 1116
  24  AppName                         0x000d3b42 main (main.m:14)
  25  AppName                         0x000d24d4 start + 36
  </code></pre>
  
  <p>As it suggests, Its a semaphore wait trap, something related to Locks I think. Is this a problem with Reachability API or is it something that I have called incorrectly. Please help.</p>
  
  <p>This is how my checkNetworkStatus method looks like:</p>
  
  <pre><code>- (void) checkNetworkStatus {
  
  NetworkStatus internetStatus = [internetReachable currentReachabilityStatus];
  switch (internetStatus) {
      case NotReachable:
      {
          //The internet is down
  
          break;
      }
      case ReachableViaWiFi:
      {
          //The internet is working via WIFI
  
          break;
      }
      case ReachableViaWWAN:
      {
          //The internet is working via WWAN
  
          break;
      }
  }
  
  NetworkStatus hostStatus = [hostReachable currentReachabilityStatus];
  switch (hostStatus) {
      case NotReachable:
      {
          //A gateway to the host server is down
  
          break;
      }
      case ReachableViaWiFi:
      {
          //A gateway to the host server is working via WIFI
  
          break;
      }
      case ReachableViaWWAN:
      {
          //A gateway to the host server is working via WWAN
  
          break;
      }
  }
  }
  </code></pre>