【发布时间】:2019-05-19 08:49:07
【问题描述】:
我正在尝试向我的应用添加容器视图。但是,它不断崩溃并出现以下错误:
'NSInternalInconsistencyException',原因:'containerView 是必需的。'
我创建了一个新项目来测试错误发生的时间。当我添加一个容器视图并将其分配给“viewController”类时,它工作正常(链接图片显示了这一点)。然后我添加一个名为“MainViewController”的新 UIPagecontroller 类,并将其分配给容器所在的原始 viewController - 当我运行它时,它会崩溃并出现相同的错误 - 这是为什么?
我还没有添加任何代码,所以我没有链接,但这里是控制台错误:
2018-12-18 21:25:38.171283+0000 caca2[19001:1863302] *** Assertion failure in -[UIStoryboardEmbedSegueTemplate newDefaultPerformHandlerForSegue:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3698.54.4/UIStoryboardEmbedSegueTemplate.m:34
2018-12-18 21:25:38.190027+0000 caca2[19001:1863302] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'containerView is required.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000107b921e6 __exceptionPreprocess + 294
1 libobjc.A.dylib 0x0000000103ff8031 objc_exception_throw + 48
2 CoreFoundation 0x0000000107b97472 +[NSException raise:format:arguments:] + 98
3 Foundation 0x0000000103a9b652 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4 UIKit 0x00000001054cb49e __67-[UIStoryboardEmbedSegueTemplate newDefaultPerformHandlerForSegue:]_block_invoke + 796
5 UIKit 0x00000001051b8f47 -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 276
6 UIKit 0x00000001051b8e05 -[UIStoryboardSegueTemplate _perform:] + 82
7 UIKit 0x00000001051b90c7 -[UIStoryboardSegueTemplate perform:] + 157
8 UIKit 0x0000000104a37f11 -[UIViewController loadViewIfRequired] + 671
9 UIKit 0x0000000104a38574 -[UIViewController view] + 27
10 UIKit 0x0000000104906123 -[UIWindow addRootViewControllerViewIfPossible] + 122
11 UIKit 0x0000000104906834 -[UIWindow _setHidden:forced:] + 294
12 UIKit 0x00000001049195cc -[UIWindow makeKeyAndVisible] + 42
13 UIKit 0x000000010488d3da -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4739
14 UIKit 0x00000001048925cb -[UIApplication _runWithMainScene:transitionContext:completion:] + 1677
15 UIKit 0x0000000104c54f7e __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
16 UIKit 0x0000000105027a39 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
17 UIKit 0x0000000104c54bba -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
18 UIKit 0x0000000104c553db -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 675
19 UIKit 0x00000001055c6614 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 299
20 UIKit 0x00000001055c64ae -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
21 UIKit 0x00000001052aa75d __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
22 UIKit 0x00000001054a54b7 _performActionsWithDelayForTransitionContext + 100
23 UIKit 0x00000001052aa627 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
24 UIKit 0x00000001050270e0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
25 UIKit 0x0000000104890eac -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
26 UIKit 0x0000000104e63bcb -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
27 FrontBoardServices 0x0000000109bc22f3 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 331
28 FrontBoardServices 0x0000000109bcacfa __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 225
29 libdispatch.dylib 0x0000000108cf67ec _dispatch_client_callout + 8
30 libdispatch.dylib 0x0000000108cfbdb8 _dispatch_block_invoke_direct + 592
31 FrontBoardServices 0x0000000109bf6470 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
32 FrontBoardServices 0x0000000109bf612e -[FBSSerialQueue _performNext] + 439
33 FrontBoardServices 0x0000000109bf668e -[FBSSerialQueue _performNextFromRunLoopSource] + 45
34 CoreFoundation 0x0000000107b34bb1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
35 CoreFoundation 0x0000000107b194af __CFRunLoopDoSources0 + 271
36 CoreFoundation 0x0000000107b18a6f __CFRunLoopRun + 1263
37 CoreFoundation 0x0000000107b1830b CFRunLoopRunSpecific + 635
38 GraphicsServices 0x000000010a48ba73 GSEventRunModal + 62
39 UIKit 0x0000000104894057 UIApplicationMain + 159
40 caca2 0x00000001036edd37 main + 55
41 libdyld.dylib 0x0000000108d73955 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
任何有关如何解决此问题的帮助或建议将不胜感激! 谢谢
模拟器和xcode工作区的图片:
【问题讨论】:
标签: ios swift xcode uiview uicontainerview