Xamarin.Forms Foundation.MonoTouchException: Objective-C 抛出异常。名称:NSInternalInconsistencyException

Xamarin.Forms Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException

Foundation.MonoTouchException: Objective-C 抛出异常。名称:NSInternalInconsistencyException 原因:应用程序 windows 应该在应用程序启动结束时有一个根视图控制器

Native stack trace:
0   CoreFoundation                      0x0000000104e4d1e6 __exceptionPreprocess + 294
1   libobjc.A.dylib                     0x0000000112c18031 objc_exception_throw + 48
2   CoreFoundation                      0x0000000104e52472 +[NSException raise:format:arguments:] + 98
3   Foundation                          0x0000000105a7d652 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193
4   UIKit                               0x0000000109bd4b96 -[UIApplication _runWithMainScene:transitionContext:completion:] + 3064
5   UIKit                               0x0000000109f96e4a __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
6   UIKit                               0x000000010a369909 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
7   UIKit                               0x0000000109f96a86 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236
8   UIKit                               0x0000000109f972a7 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 675
9   UIKit                               0x000000010a9084d4 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 299
10  UIKit                               0x000000010a90836e -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433
11  UIKit                               0x000000010a5ec62d __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
12  UIKit                               0x000000010a7e7387 _performActionsWithDelayForTransitionContext + 100
13  UIKit                               0x000000010a5ec4f7 -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223
14  UIKit                               0x000000010a368fb0 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
15  UIKit                               0x0000000109bd2f0c -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
16  UIKit                               0x000000010a1a5a97 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
17  FrontBoardServices                  0x0000000117f362f3 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 331
18  FrontBoardServices                  0x0000000117f3ecfa __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 225
19  libdispatch.dylib                   0x000000011356f779 _dispatch_client_callout + 8
20  libdispatch.dylib                   0x0000000113574931 _dispatch_block_invoke_direct + 317
21  FrontBoardServices                  0x0000000117f6a470 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
22  FrontBoardServices                  0x0000000117f6a12e -[FBSSerialQueue _performNext] + 439
23  FrontBoardServices                  0x0000000117f6a68e -[FBSSerialQueue _performNextFromRunLoopSource] + 45
24  CoreFoundation                      0x0000000104defbb1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
25  CoreFoundation                      0x0000000104dd44af __CFRunLoopDoSources0 + 271
26  CoreFoundation                      0x0000000104dd3a6f __CFRunLoopRun + 1263
27  CoreFoundation                      0x0000000104dd330b CFRunLoopRunSpecific + 635
28  GraphicsServices                    0x00000001165faa73 GSEventRunModal + 62
29  UIKit                               0x0000000109bd60b7 UIApplicationMain + 159
30  ???                                 0x0000000133339607 0x0 + 5153986055
31  ???                                 0x0000000133339373 0x0 + 5153985395

如果您在使用 Xamarin Forms 时遇到此错误,您可能应该检查您的初始页面是否构建正确。当 XF 无法创建您的初始页面并继续 运行.

时,就会发生这种情况。