由于KERN_INVALID_ADDRESS,presentViewController崩溃

时间:2015-03-09 08:09:28

标签: ios

我想使用以下代码呈现viewController。 由于其他一些原因,我需要在呈现控制器之前获得synchrolock。

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    LogInfo(@"get synchrolock On a background thread");
    [RuiKlasseBaseViewController waitSemaphore];
    dispatch_async(dispatch_get_main_queue(), ^{
    LogInfo(@"presentViewController On main thread");
        if (self.view.window) {
            TeachingViewController*teachingController=[self.storyboard instantiateViewControllerWithIdentifier:@"Teaching"];
            [self presentViewController:teachingController animated:YES completion:releaseSynchrolock];
        } else {
            LogInfo(@"release synchrolock");
            [RuiKlasseBaseViewController signalSemaphore];
            [self hidetital];
        }

    });
});

但有时在线上坠毁:

[self presentViewController:teachingController animated:YES completion:releaseSynchrolock];

崩溃日志:

Incident Identifier: B006117F-5F84-47B1-8B38-12BBD67D6383
CrashReporter Key:   95d234d099f2443ad742fad4e44bedb9c9dd5341
Hardware Model:      iPad4,4
Process:             MyApp [235]
Path:                /private/var/mobile/Containers/Bundle/Application/C476541C-FA4B-479E-8744-18213785C697/MyApp.app/MyApp
Identifier:          com.test.myapp
Version:             1180 (2.0.190)
Code Type:           ARM-64 (Native)
Parent Process:      launchd [1]

Date/Time:           2015-03-09 13:54:49.910 +0800
Launch Time:         2015-03-09 13:36:19.134 +0800
OS Version:          iOS 8.1.2 (12B440)
Report Version:      105

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000000000000a4
Triggered by Thread:  15

Thread 0 name:  Dispatch queue: com.apple.main-thread
Thread 0:
0   CoreFoundation                  0x000000018538180c -[CFPrefsSearchListSource generationCountFromListOfSources:count:allowFetching:] + 112
1   CoreFoundation                  0x0000000185381db8 -[CFPrefsSearchListSource alreadylocked_copyDictionary] + 152
2   CoreFoundation                  0x0000000185381db8 -[CFPrefsSearchListSource alreadylocked_copyDictionary] + 152
3   CoreFoundation                  0x0000000185380fcc -[CFPrefsSearchListSource alreadylocked_copyValueForKey:] + 44
4   CoreFoundation                  0x000000018540f248 ___CFPreferencesCopyAppValueWithContainer_block_invoke + 68
5   CoreFoundation                  0x0000000185380120 +[CFPrefsSearchListSource withSearchListForIdentifier:container:perform:] + 576
6   CoreFoundation                  0x000000018540f1b8 _CFPreferencesCopyAppValueWithContainer + 196
7   Foundation                      0x00000001861bdc28 -[NSUserDefaults(NSUserDefaults) objectForKey:] + 36
8   WebKitLegacy                    0x0000000193f6e244 -[WebPreferences _valueForKey:] + 264
9   WebKitLegacy                    0x0000000193f6e0ec -[WebPreferences _integerValueForKey:] + 24
10  WebKitLegacy                    0x0000000193f749ec -[WebView(WebPrivate) _preferencesChanged:] + 5636
11  WebKitLegacy                    0x0000000193f702d0 -[WebView(WebPrivate) _commonInitializationWithFrameName:groupName:] + 2332
12  WebKitLegacy                    0x0000000193fe0ef4 -[WebView(WebPrivate) _initWithFrame:frameName:groupName:] + 148
13  UIKit                           0x0000000189ce9f30 -[UIWebDocumentView initWithWebView:frame:] + 336
14  UIKit                           0x0000000189ce9b88 -[UIWebBrowserView initWithWebView:frame:] + 52
15  UIKit                           0x0000000189ce9ac8 -[UIWebBrowserView initWithFrame:] + 48
16  UIKit                           0x0000000189f58d5c -[UIWebView _webViewCommonInitWithWebView:scalesPageToFit:] + 268
17  UIKit                           0x0000000189f596e4 -[UIWebView initWithCoder:] + 120
18  UIKit                           0x000000018a068d94 UINibDecoderDecodeObjectForValue + 808
19  UIKit                           0x000000018a068a50 -[UINibDecoder decodeObjectForKey:] + 340
20  UIKit                           0x0000000189f901b8 -[UIRuntimeConnection initWithCoder:] + 124
21  UIKit                           0x000000018a068d94 UINibDecoderDecodeObjectForValue + 808
22  UIKit                           0x000000018a068d34 UINibDecoderDecodeObjectForValue + 712
23  UIKit                           0x000000018a068a50 -[UINibDecoder decodeObjectForKey:] + 340
24  UIKit                           0x0000000189f8f640 -[UINib instantiateWithOwner:options:] + 1096
25  UIKit                           0x0000000189e94270 -[UIViewController _loadViewFromNibNamed:bundle:] + 280
26  UIKit                           0x0000000189b84840 -[UIViewController loadViewIfRequired] + 84
27  UIKit                           0x0000000189b847ac -[UIViewController view] + 28
28  UIKit                           0x000000018a275c30 -[_UIFullscreenPresentationController _setPresentedViewController:] + 72
29  UIKit                           0x0000000189e7f1c4 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 116
30  UIKit                           0x0000000189e9a264 -[UIViewController _presentViewController:withAnimationController:completion:] + 1968
31  UIKit                           0x0000000189e9c67c __62-[UIViewController presentViewController:animated:completion:]_block_invoke + 116
32  UIKit                           0x0000000189c71cec -[UIViewController presentViewController:animated:completion:] + 212
33  MyApp                       0x00000001002a4438 __32-[LessonViewController shangke:]_block_invoke_2 (LessonViewController.m:656)
34  libdispatch.dylib               0x00000001964313a8 _dispatch_call_block_and_release + 20
35  libdispatch.dylib               0x0000000196431368 _dispatch_client_callout + 12
36  libdispatch.dylib               0x000000019643597c _dispatch_main_queue_callback_4CF + 928
37  CoreFoundation                  0x0000000185389fa0 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
38  CoreFoundation                  0x0000000185388048 __CFRunLoopRun + 1488
39  CoreFoundation                  0x00000001852b50a0 CFRunLoopRunSpecific + 392
40  GraphicsServices                0x000000018e41b5a0 GSEventRunModal + 164
41  UIKit                           0x0000000189bea3bc UIApplicationMain + 1484
42  MyApp                       0x000000010024fc44 main (main.m:16)
43  libdyld.dylib                   0x000000019645aa04 start + 0

Thread 1 name:  Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0   libsystem_kernel.dylib          0x0000000196558c94 kevent64 + 8
1   libdispatch.dylib               0x000000019644097c _dispatch_mgr_invoke + 272
2   libdispatch.dylib               0x00000001964333b0 _dispatch_mgr_thread + 48

Thread 2 name:  AFNetworking
Thread 2:
0   libsystem_kernel.dylib          0x0000000196558e7c mach_msg_trap + 8
1   libsystem_kernel.dylib          0x0000000196558cf4 mach_msg + 68
2   CoreFoundation                  0x0000000185389ecc __CFRunLoopServiceMachPort + 196
3   CoreFoundation                  0x0000000185387e20 __CFRunLoopRun + 936
4   CoreFoundation                  0x00000001852b50a0 CFRunLoopRunSpecific + 392
5   Foundation                      0x00000001861bd800 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 312
6   Foundation                      0x0000000186217ef4 -[NSRunLoop(NSRunLoop) run] + 92
7   MyApp                       0x00000001000c9398 +[AFURLConnectionOperation networkRequestThreadEntryPoint:] (AFURLConnectionOperation.m:193)
8   Foundation                      0x00000001862a5c08 __NSThread__main__ + 1068
9   libsystem_pthread.dylib         0x000000019660fe7c _pthread_body + 160
10  libsystem_pthread.dylib         0x000000019660fdd8 _pthread_start + 156
11  libsystem_pthread.dylib         0x000000019660cfac thread_start + 0

Thread 3 name:  com.apple.NSURLConnectionLoader
Thread 3:
0   libsystem_kernel.dylib          0x0000000196558e7c mach_msg_trap + 8
1   libsystem_kernel.dylib          0x0000000196558cf4 mach_msg + 68
2   CoreFoundation                  0x0000000185389ecc __CFRunLoopServiceMachPort + 196
3   CoreFoundation                  0x0000000185387e20 __CFRunLoopRun + 936
4   CoreFoundation                  0x00000001852b50a0 CFRunLoopRunSpecific + 392
5   CFNetwork                       0x0000000184dba4e4 +[NSURLConnection(Loader) _resourceLoadLoop:] + 436
6   Foundation                      0x00000001862a5c08 __NSThread__main__ + 1068
7   libsystem_pthread.dylib         0x000000019660fe7c _pthread_body + 160
8   libsystem_pthread.dylib         0x000000019660fdd8 _pthread_start + 156
9   libsystem_pthread.dylib         0x000000019660cfac thread_start + 0

Thread 4 name:  com.apple.CFSocket.private
Thread 4:
0   libsystem_kernel.dylib          0x0000000196573498 __select + 8
1   CoreFoundation                  0x000000018538f8c4 __CFSocketManager + 656
2   libsystem_pthread.dylib         0x000000019660fe7c _pthread_body + 160
3   libsystem_pthread.dylib         0x000000019660fdd8 _pthread_start + 156
4   libsystem_pthread.dylib         0x000000019660cfac thread_start + 0

Thread 5 name:  WebThread
Thread 5:
0   libsystem_kernel.dylib          0x0000000196558e7c mach_msg_trap + 8
1   libsystem_kernel.dylib          0x0000000196558cf4 mach_msg + 68
2   CoreFoundation                  0x0000000185389ecc __CFRunLoopServiceMachPort + 196
3   CoreFoundation                  0x0000000185387e20 __CFRunLoopRun + 936
4   CoreFoundation                  0x00000001852b50a0 CFRunLoopRunSpecific + 392
5   WebCore                         0x00000001930ec854 RunWebThread(void*) + 464
6   libsystem_pthread.dylib         0x000000019660fe7c _pthread_body + 160
7   libsystem_pthread.dylib         0x000000019660fdd8 _pthread_start + 156
8   libsystem_pthread.dylib         0x000000019660cfac thread_start + 0

Thread 6 name:  JavaScriptCore::BlockFree
Thread 6:
0   libsystem_kernel.dylib          0x0000000196573078 __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x000000019660efe0 _pthread_cond_wait + 620
2   libc++.1.dylib                  0x0000000195580cac std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 52
3   JavaScriptCore                  0x00000001868415f8 JSC::BlockAllocator::blockFreeingThreadMain() + 228
4   JavaScriptCore                  0x000000018683cb7c WTF::wtfThreadEntryPoint(void*) + 20
5   libsystem_pthread.dylib         0x000000019660fe7c _pthread_body + 160
6   libsystem_pthread.dylib         0x000000019660fdd8 _pthread_start + 156
7   libsystem_pthread.dylib         0x000000019660cfac thread_start + 0

Thread 7 name:  JavaScriptCore::Marking
Thread 7:
0   libsystem_kernel.dylib          0x0000000196573078 __psynch_cvwait + 8
1   libsystem_pthread.dylib         0x000000019660efe0 _pthread_cond_wait + 620
2   libc++.1.dylib                  0x0000000195580cac std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 52
3   JavaScriptCore                  0x0000000186aea8b8 JSC::GCThread::waitForNextPhase() + 152
4   JavaScriptCore                  0x0000000186aea95c JSC::GCThread::gcThreadMain() + 88
5   JavaScriptCore                  0x000000018683cb7c WTF::wtfThreadEntryPoint(void*) + 20
6   libsystem_pthread.dylib         0x000000019660fe7c _pthread_body + 160
7   libsystem_pthread.dylib         0x000000019660fdd8 _pthread_start + 156
8   libsystem_pthread.dylib         0x000000019660cfac thread_start + 0

Thread 8 name:  WebCore: CFNetwork Loader
Thread 8:
0   libsystem_kernel.dylib          0x0000000196558e7c mach_msg_trap + 8
1   libsystem_kernel.dylib          0x0000000196558cf4 mach_msg + 68
2   CoreFoundation                  0x0000000185389ecc __CFRunLoopServiceMachPort + 196
3   CoreFoundation                  0x0000000185387e20 __CFRunLoopRun + 936
4   CoreFoundation                  0x00000001852b50a0 CFRunLoopRunSpecific + 392
5   WebCore                         0x0000000193120670 WebCore::runLoaderThread(void*) + 284
6   JavaScriptCore                  0x000000018683cb7c WTF::wtfThreadEntryPoint(void*) + 20
7   libsystem_pthread.dylib         0x000000019660fe7c _pthread_body + 160
8   libsystem_pthread.dylib         0x000000019660fdd8 _pthread_start + 156
9   libsystem_pthread.dylib         0x000000019660cfac thread_start + 0

Thread 9:
0   libsystem_kernel.dylib          0x0000000196558e7c mach_msg_trap + 8
1   libsystem_kernel.dylib          0x0000000196558cf4 mach_msg + 68
2   CoreFoundation                  0x0000000185389ecc __CFRunLoopServiceMachPort + 196
3   CoreFoundation                  0x0000000185387e20 __CFRunLoopRun + 936
4   CoreFoundation                  0x00000001852b50a0 CFRunLoopRunSpecific + 392
5   CoreFoundation                  0x00000001853071f8 CFRunLoopRun + 108
6   CoreMotion                      0x0000000185cb298c 0x185c70000 + 272780
7   libsystem_pthread.dylib         0x000000019660fe7c _pthread_body + 160
8   libsystem_pthread.dylib         0x000000019660fdd8 _pthread_start + 156
9   libsystem_pthread.dylib         0x000000019660cfac thread_start + 0

Thread 10:
0   libsystem_kernel.dylib          0x0000000196573c78 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x000000019660d390 _pthread_wqthread + 988
2   libsystem_pthread.dylib         0x000000019660cfa4 start_wqthread + 0

Thread 11 name:  Dispatch queue: cocoa.lumberjack
Thread 11:
0   libsystem_kernel.dylib          0x0000000196558eb8 semaphore_wait_trap + 8
1   libdispatch.dylib               0x000000019643ed98 _dispatch_group_wait_slow + 244
2   MyApp                       0x0000000100137d18 +[DDLog lt_log:] (DDLog.m:665)
3   MyApp                       0x0000000100136370 __40+[DDLog queueLogMessage:asynchronously:]_block_invoke (DDLog.m:286)
4   libdispatch.dylib               0x00000001964313a8 _dispatch_call_block_and_release + 20
5   libdispatch.dylib               0x0000000196431368 _dispatch_client_callout + 12
6   libdispatch.dylib               0x000000019643b4bc _dispatch_queue_drain + 1212
7   libdispatch.dylib               0x0000000196434470 _dispatch_queue_invoke + 128
8   libdispatch.dylib               0x000000019643d220 _dispatch_root_queue_drain + 660
9   libdispatch.dylib               0x000000019643e758 _dispatch_worker_thread3 + 104
10  libsystem_pthread.dylib         0x000000019660d2e0 _pthread_wqthread + 812
11  libsystem_pthread.dylib         0x000000019660cfa4 start_wqthread + 0

Thread 12 name:  Dispatch queue: com.apple.root.default-qos.overcommit
Thread 12:
0   libsystem_kernel.dylib          0x0000000196573c78 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x0000000196611838 _pthread_workqueue_addthreads + 60
2   libdispatch.dylib               0x000000019643cbf8 _dispatch_queue_wakeup_global_slow + 80
3   libdispatch.dylib               0x000000019643d1e4 _dispatch_root_queue_drain + 600
4   libdispatch.dylib               0x000000019643e758 _dispatch_worker_thread3 + 104
5   libsystem_pthread.dylib         0x000000019660d2e0 _pthread_wqthread + 812
6   libsystem_pthread.dylib         0x000000019660cfa4 start_wqthread + 0

Thread 13:
0   libsystem_kernel.dylib          0x0000000196573c78 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x000000019660d390 _pthread_wqthread + 988
2   libsystem_pthread.dylib         0x000000019660cfa4 start_wqthread + 0

Thread 14 name:  Dispatch queue: com.apple.root.default-qos
Thread 14:
0   libsystem_kernel.dylib          0x0000000196572420 __connect + 8
1   MyApp                       0x00000001001e3d44 -[CommandSender sendUsingTCPForCommand:withObj:] (CommandSender.m:154)
2   MyApp                       0x00000001001e3254 __47-[CommandSender sendCommandType:using:withObj:]_block_invoke (CommandSender.m:43)
3   libdispatch.dylib               0x00000001964313a8 _dispatch_call_block_and_release + 20
4   libdispatch.dylib               0x0000000196431368 _dispatch_client_callout + 12
5   libdispatch.dylib               0x000000019643d408 _dispatch_root_queue_drain + 1148
6   libdispatch.dylib               0x000000019643e758 _dispatch_worker_thread3 + 104
7   libsystem_pthread.dylib         0x000000019660d2e0 _pthread_wqthread + 812
8   libsystem_pthread.dylib         0x000000019660cfa4 start_wqthread + 0

Thread 15 Crashed:
0   QuartzCore                      0x00000001894d67ec CA::Layer::collect_animations_(double, double*, CA::Layer::CollectAnimationsData*) + 76
1   QuartzCore                      0x00000001894d6930 CA::Layer::collect_animations_(double, double*, CA::Layer::CollectAnimationsData*) + 400
2   QuartzCore                      0x00000001894d6930 CA::Layer::collect_animations_(double, double*, CA::Layer::CollectAnimationsData*) + 400
3   QuartzCore                      0x00000001894d6930 CA::Layer::collect_animations_(double, double*, CA::Layer::CollectAnimationsData*) + 400
4   QuartzCore                      0x00000001894d6930 CA::Layer::collect_animations_(double, double*, CA::Layer::CollectAnimationsData*) + 400
5   QuartzCore                      0x00000001894d6790 CA::Layer::collect_animations(CA::Transaction*, double, double*) + 36
6   QuartzCore                      0x00000001894d406c CA::Context::commit_transaction(CA::Transaction*) + 1400
7   QuartzCore                      0x00000001894d3988 CA::Transaction::commit() + 432
8   QuartzCore                      0x0000000189504028 CA::Transaction::release_thread(void*) + 200
9   libsystem_pthread.dylib         0x000000019660e3dc _pthread_tsd_cleanup + 196
10  libsystem_pthread.dylib         0x000000019660e0a8 _pthread_exit + 136
11  libsystem_pthread.dylib         0x000000019660f32c pthread_exit + 40
12  Foundation                      0x00000001861d6ffc +[NSThread exit] + 12
13  Foundation                      0x00000001862a5c20 __NSThread__main__ + 1092
14  libsystem_pthread.dylib         0x000000019660fe7c _pthread_body + 160
15  libsystem_pthread.dylib         0x000000019660fdd8 _pthread_start + 156
16  libsystem_pthread.dylib         0x000000019660cfac thread_start + 0

Thread 16:
0   libsystem_kernel.dylib          0x0000000196573c78 __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x000000019660d390 _pthread_wqthread + 988
2   libsystem_pthread.dylib         0x000000019660cfa4 start_wqthread + 0

Thread 15 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x000000014f939200   x2: 0x00000001063eb910   x3: 0x00000001063f3970
    x4: 0x0000000003000001   x5: 0x0000000000000000   x6: 0x0000000000000000   x7: 0x0000000000000000
    x8: 0x0000000000000001   x9: 0x0000000000000008  x10: 0x0000000000000001  x11: 0x0000000000004800
   x12: 0x0000000000000000  x13: 0x0000000102a4d688  x14: 0x0000000000000000  x15: 0x0000000000000000
   x16: 0x000000019657dd74  x17: 0x0000000195dffea0  x18: 0x0000000000000000  x19: 0x00000001063eb910
   x20: 0x0000000000000004  x21: 0x00000001063eb718  x22: 0x0000000197313000  x23: 0x0000000000000000
   x24: 0x0000000000000001  x25: 0x00000001063eb718  x26: 0x0000000102b4a084  x27: 0x0000000000000003
   x28: 0x0000000000000001  fp: 0x00000001063eb6f0   lr: 0x00000001894d6934
    sp: 0x00000001063eb650   pc: 0x00000001894d67ec cpsr: 0x20000000

非常感谢任何帮助。 感谢。

0 个答案:

没有答案