在我们的应用程序中,我们调用一个方法,通过viewControllers属性将两个导航控制器添加到UISplitViewController。我们在我们的应用程序中的多个位置执行此操作,但这一个位置导致SIGABRT,我无法弄清楚原因。此时,UISplitViewController.viewControllers在NSArray中已经有两个视图控制器。仅当设备处于纵向且仅在iOS 8上时才会发生错误。
SIGABRT附带的错误是:
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 11 beyond bounds [0 .. 10]'
导致错误的代码行是
self.splitViewController.viewControllers = @[mainNav.navigationController, genericNavVC];
它必须是属性的东西,因为它似乎并不重要我试图分配它(无,2空白UINavigationControllers等)。我也尝试过使用setViewControllers方法,但它仍然存在问题。
是否有人知道可能导致此问题的原因,是否有我们可以使用的解决方法?
- 额外信息 -
异常callStackSymbols的NSLog:
(
0 CoreFoundation 0x24ce6d7f <redacted> + 150
1 libobjc.A.dylib 0x3285dc77 objc_exception_throw + 38
2 CoreFoundation 0x24bfafb7 <redacted> + 230
3 myApp 0x00212ef7 -[DocsToSign objectAtIndex:] + 62
4 myApp 0x001436d3 -[DocsToSignListViewController tableView:cellForRowAtIndexPath:] + 966
5 UIKit 0x2845126d <redacted> + 476
6 UIKit 0x2845132f <redacted> + 54
7 UIKit 0x28446a51 <redacted> + 2276
8 UIKit 0x2825ec1b <redacted> + 186
9 UIKit 0x28188c1f <redacted> + 514
10 QuartzCore 0x27bb3f65 <redacted> + 136
11 QuartzCore 0x27baf951 <redacted> + 360
12 UIKit 0x2819b367 <redacted> + 138
13 UIKit 0x282358ed <redacted> + 872
14 UIKit 0x2836643d <redacted> + 284
15 UIKit 0x28232803 <redacted> + 78
16 UIKit 0x28480949 <redacted> + 536
17 UIKit 0x286474cd <redacted> + 168
18 UIKit 0x28647283 <redacted> + 138
19 UIKit 0x28474487 <redacted> + 350
20 UIKit 0x28636d13 <redacted> + 170
21 myApp 0x000eb5db -[AppDelegate_iPad ClearDetailView] + 1446
22 myApp 0x001478e9 -[DocsToSignListViewController SignDocsComplete:withResponseData:] + 1564
23 myApp 0x000fbae3 -[WCFHandler requestCompleted] + 846
24 myApp 0x000fc353 -[WCFHandler connectionDidFinishLoading:] + 86
25 CFNetwork 0x24840045 <redacted> + 56
26 CFNetwork 0x2483ffff <redacted> + 182
27 CFNetwork 0x248400f1 <redacted> + 36
28 CFNetwork 0x2475527b <redacted> + 78
29 CFNetwork 0x247f18c5 <redacted> + 60
30 CFNetwork 0x24746189 <redacted> + 60
31 CoreFoundation 0x24bf83f1 CFArrayApplyFunction + 36
32 CFNetwork 0x24746043 <redacted> + 182
33 CFNetwork 0x24745f09 <redacted> + 216
34 CFNetwork 0x24745da5 <redacted> + 48
35 CoreFoundation 0x24cad5e7 <redacted> + 14
36 CoreFoundation 0x24cac9fb <redacted> + 222
37 CoreFoundation 0x24cab079 <redacted> + 768
38 CoreFoundation 0x24bf8981 CFRunLoopRunSpecific + 476
39 CoreFoundation 0x24bf8793 CFRunLoopRunInMode + 106
40 GraphicsServices 0x2bfa8051 GSEventRunModal + 136
41 UIKit 0x281ea981 UIApplicationMain + 1440
42 myApp 0x000e8a09 main + 48
43 libdyld.dylib 0x32df9aaf <redacted> + 2
)
这是在异常时调用线程回溯:
* thread #1: tid = 0x2259, 0x000eb71c myApp`-[AppDelegate_iPad ClearDetailView](self=0x15571b80, _cmd=0x002b2ecd) + 1768 at AppDelegate_iPad.m:332, queue = 'com.apple.main-thread', stop reason = step over
* frame #0: 0x000eb71c myApp`-[AppDelegate_iPad ClearDetailView](self=0x15571b80, _cmd=0x002b2ecd) + 1768 at AppDelegate_iPad.m:332
frame #1: 0x001478e8 myApp`-[DocsToSignListViewController SignDocsComplete:withResponseData:](self=0x155b7820, _cmd=0x002b968f, handler=0x15511f10, responseData=0x1558ef90) + 1564 at DocsToSignListViewController.m:690
frame #2: 0x000fbae2 myApp`-[WCFHandler requestCompleted](self=0x1550b040, _cmd=0x2bf7076d) + 846 at WCFHandler.m:161
frame #3: 0x000fc352 myApp`-[WCFHandler connectionDidFinishLoading:](self=0x1550b040, _cmd=0x2898e975, connection=0x15567af0) + 86 at WCFHandler.m:243
frame #4: 0x24840044 CFNetwork`__65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 56
frame #5: 0x2483fffe CFNetwork`-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 182
frame #6: 0x248400f0 CFNetwork`-[NSURLConnectionInternal _withActiveConnectionAndDelegate:] + 36
frame #7: 0x2475527a CFNetwork`___ZN27URLConnectionClient_Classic26_delegate_didFinishLoadingEU13block_pointerFvvE_block_invoke + 78
frame #8: 0x247f18c4 CFNetwork`___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 60
frame #9: 0x24746188 CFNetwork`RunloopBlockContext::_invoke_block(void const*, void*) + 60
frame #10: 0x24bf83f0 CoreFoundation`CFArrayApplyFunction + 36
frame #11: 0x24746042 CFNetwork`RunloopBlockContext::perform() + 182
frame #12: 0x24745f08 CFNetwork`MultiplexerSource::perform() + 216
frame #13: 0x24745da4 CFNetwork`MultiplexerSource::_perform(void*) + 48
frame #14: 0x24cad5e6 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
frame #15: 0x24cac9fa CoreFoundation`__CFRunLoopDoSources0 + 222
frame #16: 0x24cab078 CoreFoundation`__CFRunLoopRun + 768
frame #17: 0x24bf8980 CoreFoundation`CFRunLoopRunSpecific + 476
frame #18: 0x24bf8792 CoreFoundation`CFRunLoopRunInMode + 106
frame #19: 0x2bfa8050 GraphicsServices`GSEventRunModal + 136
frame #20: 0x281ea980 UIKit`UIApplicationMain + 1440
frame #21: 0x000e8a08 myApp`main(argc=1, argv=0x0054cafc) + 48 at main.m:14