From f4f1abec3a0f5e5efd1ec8bc8312c97ad92deefa Mon Sep 17 00:00:00 2001 From: Ken'ichi Fukushima Date: Mon, 12 Sep 2016 18:28:49 +0900 Subject: [PATCH] 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 --- src/ios/CDVReachability.m | 1 + 1 file changed, 1 insertion(+) 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 @@ static void CDVReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRe - (void)stopNotifier { if (reachabilityRef != NULL) { + SCNetworkReachabilitySetCallback(reachabilityRef, NULL, NULL); SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode); } }