title: Reachability change cause crash
body: <p>Apple developer sample of Reachability cause Memory Leak when turning off wifi during play offline music (<a href="https://github.com/pouriaMaleki/cordova-plugin-playerhater/blob/master/src/ios" rel="noreferrer">using this code</a>) in my app and it got stuck line I mentioned bottom, It may cause by that Player code because log says <code>[__NSCFString reachabilityDidChange:]: unrecognized selector</code></p>
  
  <p><code>[[NSNotificationCenter defaultCenter] postNotificationName:kReachabilityChangedNotification object:noteObject];</code></p>
  
  <p>in this method:</p>
  
  <pre><code>static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
  {
  #pragma unused (target, flags)
      NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback");
      NSCAssert([(__bridge NSObject*) info isKindOfClass: [CDVReachability class]], @"info was wrong class in ReachabilityCallback");
  
      CDVReachability* noteObject = (__bridge CDVReachability *)info;
      // Post a notification to notify the client that the network reachability changed.
      [[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotificationString object: noteObject];
  }
  </code></pre>
  
  <p>Here is log:</p>
  
  <pre><code>2015-04-12 19:52:03.416 HelloCordova[4094:1250289] -[__NSCFString reachabilityDidChange:]: unrecognized selector sent to instance 0x174232820
  </code></pre>
  
  <p>And <code>reachabilityDidChange</code> is in this <a href="https://github.com/pouriaMaleki/cordova-plugin-playerhater/blob/master/src/ios/PRXPlayer/ReachabilityManager.m" rel="noreferrer">file</a></p>
  
  <pre><code>#import "ReachabilityManager.h"
  #import "Reachability.h"
  
  @interface ReachabilityManager ()
  @property NetworkStatus previousReachability;
  @end
  
  @implementation ReachabilityManager
  
  - (id) init {
      self = [super init];
      if (self) {
          [[NSNotificationCenter defaultCenter] addObserver:self
                                                  selector:@selector(reachabilityDidChange:)
                                                  name:kReachabilityChangedNotification
                                                  object:nil];
          self.previousReachability = -1;
      }
      return self;
  }
  
  - (void) reachabilityDidChange:(NSNotification *)notification {
      NSLog(@"reachabilityDidChange!");
  
      CDVReachability * r = [notification object];
      NetworkStatus ns = [r currentReachabilityStatus];
  
      if (self.delegate &amp;&amp; [self.delegate respondsToSelector:@selector(reachabilityDidChangeFrom:to:)]) {
          [self.delegate reachabilityDidChangeFrom:self.previousReachability to:ns];
      }
      self.previousReachability = ns;
  }
  
  @end
  </code></pre>
  
  <p>I don't know is that correct but I try this:</p>
  
  <pre><code>dispatch_async(dispatch_get_main_queue(), ^{
          [[NSNotificationCenter defaultCenter] postNotificationName:kReachabilityChangedNotification object:noteObject];
      });}
  </code></pre>
  
  <p>and even this:</p>
  
  <pre><code>// We're on the main RunLoop, so an NSAutoreleasePool is not necessary, but is added defensively
      // in case someon uses the Reachability object in a different thread.
      @autoreleasepool {
          Reachability* noteObject = (__bridge Reachability*)info;
          // Post a notification to notify the client that the network reachability changed.
          [[NSNotificationCenter defaultCenter] postNotificationName:kReachabilityChangedNotification object:noteObject];
      }
  </code></pre>