可达性reachabilityWithHostName在发布模式下崩溃应用程序

时间:2013-09-24 11:01:29

标签: iphone objective-c reachability

我面临着非常奇怪的问题。我在我的项目中使用了Reachability 3.0

我使用了以下代码

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityChanged:) name:kReachabilityChangedNotification object:nil];
self.hostReachability = [Reachability reachabilityWithHostName:HOST_NAME];
[self.hostReachability startNotifier];
[self updateInterfaceWithReachability:self.hostReachability];

self.internetReachability = [Reachability reachabilityForInternetConnection];
[self.internetReachability startNotifier];
[self updateInterfaceWithReachability:self.internetReachability];

当构建配置设置为Debug模式时,每个东西都在模拟器和设备中完美运行。 现在,当构建配置设置为释放模式时,我为我的客户端进行AdHoc构建时崩溃。

当我从上面评论以下代码时,它可以正常工作

self.hostReachability = [Reachability reachabilityWithHostName:HOST_NAME];

有人可以帮我解决这个问题吗?

更新 我的崩溃日志

Date/Time:       2013-09-24 12:52:39.623 +0500
OS Version:      iOS 6.1.3 (10B329)
Report Version:  104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Crashed Thread:  0

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x3b07b350 __pthread_kill + 8
1   libsystem_c.dylib               0x3aff211e pthread_kill + 54
2   libsystem_c.dylib               0x3b02e96e abort + 90
3   libsystem_c.dylib               0x3b00f4cc __assert_rtn + 176
4   SystemConfiguration             0x34a99452 SCNetworkReachabilitySetCallback + 178
5   MYAPPLICATION                           0x000bcdee 0xa1000 + 114158
6   MYAPPLICATION                           0x000a21a8 0xa1000 + 4520
7   UIKit                           0x34b2aad4 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 248
8   UIKit                           0x34b2a65e -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1186
9   UIKit                           0x34b22846 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 694
10  UIKit                           0x34acac34 -[UIApplication handleEvent:withNewEvent:] + 1000
11  UIKit                           0x34aca6c8 -[UIApplication sendEvent:] + 68
12  UIKit                           0x34aca116 _UIApplicationHandleEvent + 6150
13  GraphicsServices                0x367d55a0 _PurpleEventCallback + 588
14  GraphicsServices                0x367d51ce PurpleEventCallback + 30
15  CoreFoundation                  0x32c97170 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
16  CoreFoundation                  0x32c97112 __CFRunLoopDoSource1 + 134
17  CoreFoundation                  0x32c95f94 __CFRunLoopRun + 1380
18  CoreFoundation                  0x32c08eb8 CFRunLoopRunSpecific + 352
19  CoreFoundation                  0x32c08d44 CFRunLoopRunInMode + 100
20  UIKit                           0x34b21480 -[UIApplication _run] + 664
21  UIKit                           0x34b1e2fc UIApplicationMain + 1116
22  MYAPPLICATION                           0x000a209a 0xa1000 + 4250
23  libdyld.dylib                   0x3afb4b1c start + 0

Thread 1:
0   libsystem_kernel.dylib          0x3b07bd98 __workq_kernreturn + 8
1   libsystem_c.dylib               0x3afc9cf6 _pthread_workq_return + 14
2   libsystem_c.dylib               0x3afc9a12 _pthread_wqthread + 362
3   libsystem_c.dylib               0x3afc98a0 start_wqthread + 4

Thread 2 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 2:
0   libsystem_kernel.dylib          0x3b06b648 kevent64 + 24
1   libdispatch.dylib               0x3af9b974 _dispatch_mgr_invoke + 792
2   libdispatch.dylib               0x3af9b654 _dispatch_mgr_thread$VARIANT$mp + 32

Thread 3:
0   libsystem_kernel.dylib          0x3b07bd98 __workq_kernreturn + 8
1   libsystem_c.dylib               0x3afc9cf6 _pthread_workq_return + 14
2   libsystem_c.dylib               0x3afc9a12 _pthread_wqthread + 362
3   libsystem_c.dylib               0x3afc98a0 start_wqthread + 4

Thread 4 name:  WebThread
Thread 4:
0   libsystem_kernel.dylib          0x3b06aeb4 mach_msg_trap + 20
1   libsystem_kernel.dylib          0x3b06b048 mach_msg + 36
2   CoreFoundation                  0x32c97040 __CFRunLoopServiceMachPort + 124
3   CoreFoundation                  0x32c95d9e __CFRunLoopRun + 878
4   CoreFoundation                  0x32c08eb8 CFRunLoopRunSpecific + 352
5   CoreFoundation                  0x32c08d44 CFRunLoopRunInMode + 100
6   WebCore                         0x38c0f500 RunWebThread(void*) + 440
7   libsystem_c.dylib               0x3afd430e _pthread_start + 306
8   libsystem_c.dylib               0x3afd41d4 thread_start + 4

Thread 0 crashed with ARM Thread State (32-bit):
r0: 0x00000000    r1: 0x00000000      r2: 0x00000000      r3: 0x3cb75534
r4: 0x00000006    r5: 0x3cb75b88      r6: 0x34ac01c6      r7: 0x2fd5e710
r8: 0x34ac0171    r9: 0x2fd5e660     r10: 0x3cb75608     r11: 0x20853880
ip: 0x00000148    sp: 0x2fd5e704      lr: 0x3aff2123      pc: 0x3b07b350
cpsr: 0x00000010

1 个答案:

答案 0 :(得分:0)

写这里只是为了帮助有同样问题的人。

我正在使用Xcode 4.6 Reachability version 3.0开发应用程序。

当我使用Xcode 5运行相同的应用程序时,它工作得很好。

因此,作为一种解决方法,现在我正在使用旧版本的Reachability,并且它正在使用Xcode 4.6而没有任何问题。