需要帮助。启动应用程序时收到以下错误
抛出Objective-C异常。名称:NSInternalInconsistencyException原因:应用程序窗口在应用程序启动结束时应具有根视图控制器 本机堆栈跟踪: 0 CoreFoundation 0x00000001160421e6 exceptionPreprocess + 294 1个libobjc.A.dylib 0x0000000116fdf031 objc_exception_throw + 48 2 CoreFoundation 0x0000000116047472 + [NSException提高:格式:参数:] + 98 3基础0x0000000114f7b652-[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193 4 UIKit 0x0000000112d1bb96-[UIApplication _runWithMainScene:transitionContext:completion:] + 3064 5 UIKit 0x00000001130dde4a __111-[__ UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] _ block_invoke + 866 6 UIKit 0x00000001134b0909 + [_ UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153 7 UIKit 0x00000001130dda86-[__ UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 236 8 UIKit 0x00000001130de2a7-[__ UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 675 9 UIKit 0x0000000113a4f4d4 __82-[_ UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] _ block_invoke + 299 10 UIKit 0x0000000113a4f36e-[_ UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 433 11 UIKit 0x000000011373362d __125-[_ UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] _ block_invoke + 221 12 UIKit 0x000000011392e387 _performActionsWithDelayForTransitionContext + 100 13 UIKit 0x00000001137334f7-[_ UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 223 14 UIKit 0x00000001134affb0-[_ UICanvas场景:didUpdateWithDiff:transitionContext:完成:] + 392 15 UIKit 0x0000000112d19f0c-[UIApplication工作区:didCreateScene:withTransitionContext:完成:] + 515 16 UIKit 0x00000001132eca97-[UIApplicationSceneClientAgent场景:didInitializeWithEvent:完成:] + 361 17 FrontBoardServices 0x000000011d9c32f3-[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 331 18 FrontBoardServices 0x000000011d9cbcfa __56- [FBSWorkspace客户端:handleCreateScene:withCompletion:] _ block_invoke_2 + 225 19 libdispatch.dylib 0x0000000117c74779 _dispatch_client_callout + 8 20 libdispatch.dylib 0x0000000117c79931 _dispatch_block_invoke_direct + 317 21 FrontBoardServices 0x000000011d9f7470 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 24 22 FrontBoardServices 0x000000011d9f712e-[FBSSerialQueue _performNext] + 439 23 FrontBoardServices 0x000000011d9f768e-[FBSSerialQueue _performNextFromRunLoopSource] + 45 24 CoreFoundation 0x0000000115fe4bb1 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 25 CoreFoundation 0x0000000115fc94af __CFRunLoopDoSources0 + 271 26 CoreFoundation 0x0000000115fc8a6f __CFRunLoopRun + 1263 27 CoreFoundation 0x0000000115fc830b CFRunLoopRunSpecific + 635 28图形服务0x0000000119779a73 GSEventRunModal + 62 29 UIKit 0x0000000112d1d0b7 UIApplicationMain + 159 30 ??? 0x000000013437347e 0x0 + 5171000446 31 ??? 0x0000000134373213 0x0 + 5170999827
答案 0 :(得分:0)
应用程序窗口应在应用程序末尾具有根视图控制器
您似乎没有设置RootViewController。它在旧版本中工作正常。但是在新版本中,您应该在AppDelegate
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
{
// Override point for customization after application launch.
// If not required for your application you can safely delete this method
var indexVC = new XXXViewController ();//your viewcontroller
Window = new UIWindow ((CGRect)UIScreen.MainScreen.Bounds);
Window .RootViewController = indexVC;
Window .MakeKeyAndVisible ();
return true;
}