CB-11838 ios: Unregister callback function at the right timing.
We at LINE observed about 40K crashes a day that were suspected to be
caused by the reacahability callback function invoked on an
already-deallocated object. We couldn't reproduced the crash locally
but this patch did reduce the number of crash reports to zero.
This closes #49
diff --git a/src/ios/CDVReachability.m b/src/ios/CDVReachability.m
index 70177a7..b43a62d 100644
--- a/src/ios/CDVReachability.m
+++ b/src/ios/CDVReachability.m
@@ -120,6 +120,7 @@
- (void)stopNotifier
{
if (reachabilityRef != NULL) {
+ SCNetworkReachabilitySetCallback(reachabilityRef, NULL, NULL);
SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
}
}