I included crashlytics in my ios app and distributed it via enterprise. Crashlytics keeps on reporting below crash daily regarding Reachability. I googled, but didn't get what causing this crash.
Fatal Exception: NSInvalidArgumentException
-[__NSMallocBlock__ reachabilityChanged:]: unrecognized selector sent to instance 0x1c5cdfc0
Thread : Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x316642a3 __exceptionPreprocess + 162
1 libobjc.A.dylib 0x3252297f objc_exception_throw + 30
2 CoreFoundation 0x31667e07 -[NSObject(NSObject) doesNotRecognizeSelector:] + 170
3 CoreFoundation 0x31666531 ___forwarding___ + 392
4 CoreFoundation 0x315bdf68 _CF_forwarding_prep_0 + 24
5 CoreFoundation 0x315b5037 _CFXNotificationPost + 1426
6 Foundation 0x3319ed91 -[NSNotificationCenter postNotificationName:object:userInfo:] + 72
7 Foundation 0x331a2853 -[NSNotificationCenter postNotificationName:object:] + 30
8 0x0005aee9 ReachabilityCallback (Reachability.m:94)
9 SystemConfiguration 0x30f5f161 reachPerform + 924
10 CoreFoundation 0x31639683 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
11 CoreFoundation 0x31638ee9 __CFRunLoopDoSources0 + 212
12 CoreFoundation 0x31637cb7 __CFRunLoopRun + 646
13 CoreFoundation 0x315aaebd CFRunLoopRunSpecific + 356
14 CoreFoundation 0x315aad49 CFRunLoopRunInMode + 104
15 GraphicsServices 0x393a82eb GSEventRunModal + 74
16 UIKit 0x38e662f9 UIApplicationMain + 1120
17 0x00076f2f main (main.m:16)
18 libdyld.dylib 0x350bab20 start
It looks like you're registering a reachability observer which is being deallocated but not removing itself as an observer before that happens. So, when the reachability notification is posted later it is sent to a deallocated instance (i.e. random memory location) and you get a crash.
All observers (whether of reachability or any other notification with NSNotificationCenter
) should remove themselves as an observer before they are deallocated.