我使用Apple提供的可達性示例代碼來檢查網絡連接並獲取變更通知(Reachability Sample code)。可達性崩潰API
我看了一下我的應用程序的一些崩潰鎖。看起來有些崩潰是由於Reachability/SystemConfiguration Reachablity API的原因(見下文)。 SCNetworkReachabilityGetFlags僅用於Apple提供的Reachability類。或者我誤解了崩潰日誌?
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
我同意這一點,但你可以使用可達性「幫助」;例如,讓用戶知道他們在請求失敗時可能未連接到互聯網。 – 2012-12-10 02:23:36