我在我的项目中使用了 HUD。在我的应用程序中会出现这种情况:在主线程中它会做一个动画,而在子线程中它会调用睡眠。我会收到这样的崩溃日志:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0xd0000008
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x383d55b0 objc_msgSend + 16
1 UIKit 0x36b7b822 -[UIAnimator stopAnimation:] + 262
2 UIKit 0x36c16252 -[UIAnimator(Static) _advanceAnimationsOfType:withTimestamp:] + 290
3 UIKit 0x36b7b384 -[UIAnimator(Static) _LCDHeartbeatCallback:] + 48
4 QuartzCore 0x35c7006c CA::Display::DisplayLink::dispatch(unsigned long long, unsigned long long) + 156
5 QuartzCore 0x35c6ffc4 CA::Display::IOMFBDisplayLink::callback(__IOMobileFramebuffer*, unsigned long long, unsigned long long, unsigned long long, void*) + 60
6 IOMobileFramebuffer 0x312a6fd4 IOMobileFramebufferVsyncNotifyFunc + 152
7 IOKit 0x312ab446 IODispatchCalloutFromCFMessage + 190
8 CoreFoundation 0x3646d5d8 __CFMachPortPerform + 116
9 CoreFoundation 0x36478170 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 32
10 CoreFoundation 0x36478112 __CFRunLoopDoSource1 + 134
11 CoreFoundation 0x36476f94 __CFRunLoopRun + 1380
12 CoreFoundation 0x363e9eb8 CFRunLoopRunSpecific + 352
13 CoreFoundation 0x363e9d44 CFRunLoopRunInMode + 100
14 GraphicsServices 0x385962e6 GSEventRunModal + 70
15 UIKit 0x36a622fc UIApplicationMain + 1116
16 YH_EMenu 0x000e36c4 main (main.m:14)
17 YH_EMenu 0x000dd6cc start + 36
Thread 1:
0 libsystem_kernel.dylib 0x38503d98 __workq_kernreturn + 8
1 libsystem_c.dylib 0x33a27cf6 _pthread_workq_return + 14
2 libsystem_c.dylib 0x33a27a12 _pthread_wqthread + 362
3 libsystem_c.dylib 0x33a278a0 start_wqthread + 4
Thread 2 name: Dispatch queue: com.apple.libdispatch-manager
Thread 2:
0 libsystem_kernel.dylib 0x384f3648 kevent64 + 24
1 libdispatch.dylib 0x33cc8974 _dispatch_mgr_invoke + 792
2 libdispatch.dylib 0x33cc8654 _dispatch_mgr_thread$VARIANT$mp + 32
Thread 3 name: WebThread
Thread 3:
0 libsystem_kernel.dylib 0x384f2eb4 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x384f3048 mach_msg + 36
2 CoreFoundation 0x36478040 __CFRunLoopServiceMachPort + 124
3 CoreFoundation 0x36476d9e __CFRunLoopRun + 878
4 CoreFoundation 0x363e9eb8 CFRunLoopRunSpecific + 352
5 CoreFoundation 0x363e9d44 CFRunLoopRunInMode + 100
6 WebCore 0x385f9a70 RunWebThread(void*) + 440
7 libsystem_c.dylib 0x33a3230e _pthread_start + 306
8 libsystem_c.dylib 0x33a321d4 thread_start + 4
Thread 4:
0 libsystem_kernel.dylib 0x38503d98 __workq_kernreturn + 8
1 libsystem_c.dylib 0x33a27cf6 _pthread_workq_return + 14
2 libsystem_c.dylib 0x33a27a12 _pthread_wqthread + 362
3 libsystem_c.dylib 0x33a278a0 start_wqthread + 4
Thread 5:
0 libsystem_kernel.dylib 0x38503d98 __workq_kernreturn + 8
1 libsystem_c.dylib 0x33a27cf6 _pthread_workq_return + 14
2 libsystem_c.dylib 0x33a27a12 _pthread_wqthread + 362
3 libsystem_c.dylib 0x33a278a0 start_wqthread + 4
Thread 6:
0 libsystem_kernel.dylib 0x385036a4 __semwait_signal + 24
1 libsystem_c.dylib 0x33a373ce nanosleep + 138
2 libsystem_c.dylib 0x33a97de6 sleep + 42
3 YH_EMenu 0x000eb580 -[MainViewController threadENDSHOWHUD:] (MainViewController.m:939)
4 Foundation 0x342ae678 __NSThread__main__ + 968
5 libsystem_c.dylib 0x33a3230e _pthread_start + 306
6 libsystem_c.dylib 0x33a321d4 thread_start + 4
我不知道如何解决这个问题。