API crash error

I am using Apple's Reachability sample code to test network connectivity and receive change notifications ( Sample code to improve performance ).

I looked at some locks of my application. It seems that some failures are related to the Reachability / SystemConfiguration Reachablity API (see below). SCNetworkReachabilityGetFlags is used only in the Reachability class provided by Apple. Or am I misinterpreting the crash log?

Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x00000000, 0x00000000 Crashed Thread: 0 Thread 0 Crashed: 0 libSystem.B.dylib 0x00000e70 mach_msg_trap + 20 1 libSystem.B.dylib 0x00003354 mach_msg + 60 2 SystemConfiguration 0x0001f480 configopen + 168 3 SystemConfiguration 0x00004d08 SCDynamicStoreCreateWithOptions + 272 4 SystemConfiguration 0x00004e54 SCDynamicStoreCreate + 24 5 SystemConfiguration 0x00015244 updateReachabilityStoreInfo + 152 6 SystemConfiguration 0x00016f04 updateCommCenterStatus + 32 7 SystemConfiguration 0x00017678 checkAddress + 1368 8 SystemConfiguration 0x0001a260 __SCNetworkReachabilityGetFlags + 1992 9 SystemConfiguration 0x0001b00c rlsPerform + 132 10 CoreFoundation 0x00058266 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 8 11 CoreFoundation 0x00028692 __CFRunLoopDoSources0 + 214 12 CoreFoundation 0x00027f62 __CFRunLoopRun + 258 13 CoreFoundation 0x00027d74 CFRunLoopRunSpecific + 220 14 CoreFoundation 0x00027c82 CFRunLoopRunInMode + 54 15 GraphicsServices 0x00004e84 GSEventRunModal + 188 16 UIKit 0x00004f8c -[UIApplication _run] + 564 17 UIKit 0x000024cc UIApplicationMain + 964 18 MyApp 0x0000f80c main (main.m:21) 19 MyApp 0x0000f77c start + 44 
+4
source share
4 answers

I was fortunate enough to just try to open a network connection. Then, if that fails, set the flag to try the latter and avoid “reachability”. Even if “reachability” passes at startup, it can disappear and disappear at any time.

+3
source

Reach is one of the worst examples of Apple code examples.

Despite the fact that it is well aware of network connections, it is rather poor [read: hopeless] when indicating whether the host is accessible.

You can also directly associate a host with a host and catch a timeout failure.

0
source

just comment out the next line in Reachability.m, if there is one.

  [super init]; 
0
source

Use it in the first view controller. It's easy to get into trouble when used as a modal view or other derivatives.

0
source

Source: https://habr.com/ru/post/1333106/


All Articles