ios - iOS 11:“应用程序窗口在应用程序启动结束时应该有一个根视图控制器”
问题描述
我在发布模式下遇到应用程序问题。调试模式工作得很好。
每次我尝试在 Xcode 中启动应用程序时,都会抛出此错误:
2021-08-26 12:40:55.592014-0500 profile[2870:97150] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x6000025a7960> F8BB1C28-BAE8-11D6-9C31-00039315CD46
2021-08-26 12:40:55.674600-0500 profile[2870:97150] *** Assertion failure in -[UIApplication _runWithMainScene:transitionContext:completion:], UIApplication.m:4207
2021-08-26 12:40:55.833657-0500 profile[2870:97150] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff2043a126 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff20177f78 objc_exception_throw + 48
2 CoreFoundation 0x00007fff20439f4f +[NSException raise:format:] + 0
3 Foundation 0x00007fff207881ca -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 UIKitCore 0x00007fff24664758 -[UIApplication _runWithMainScene:transitionContext:completion:] + 2148
5 UIKitCore 0x00007fff23c97b95 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122
6 UIKitCore 0x00007fff2421f632 _UIScenePerformActionsWithLifecycleActionMask + 88
7 UIKitCore 0x00007fff23c986a4 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198
8 UIKitCore 0x00007fff23c98168 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 474
9 UIKitCore 0x00007fff23c984d5 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 819
10 UIKitCore 0x00007fff23c97d69 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 345
11 UIKitCore 0x00007fff23c9ff2e __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 178
12 UIKitCore 0x00007fff241298f3 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 871
13 UIKitCore 0x00007fff2423c062 _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 240
14 UIKitCore 0x00007fff23c9fccf -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 352
15 UIKitCore 0x00007fff23ac62c3 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 797
16 UIKitCore 0x00007fff23ac4d6d -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 253
17 UIKitCore 0x00007fff23ac5efc -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 208
18 UIKitCore 0x00007fff24662835 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 508
19 UIKitCore 0x00007fff24151c27 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 358
20 FrontBoardServices 0x00007fff25a56146 -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 391
21 FrontBoardServices 0x00007fff25a7ec0d __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.176 + 102
22 FrontBoardServices 0x00007fff25a63ba1 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 209
23 FrontBoardServices 0x00007fff25a7e8db __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke + 352
24 libdispatch.dylib 0x0000000107e6ea88 _dispatch_client_callout + 8
25 libdispatch.dylib 0x0000000107e719d0 _dispatch_block_invoke_direct + 295
26 FrontBoardServices 0x00007fff25aa4901 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
27 FrontBoardServices 0x00007fff25aa45e7 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 433
28 FrontBoardServices 0x00007fff25aa4aac -[FBSSerialQueue _performNextFromRunLoopSource] + 22
29 CoreFoundation 0x00007fff203a8845 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
30 CoreFoundation 0x00007fff203a873d __CFRunLoopDoSource0 + 180
31 CoreFoundation 0x00007fff203a7c1f __CFRunLoopDoSources0 + 248
32 CoreFoundation 0x00007fff203a23f7 __CFRunLoopRun + 878
33 CoreFoundation 0x00007fff203a1b9e CFRunLoopRunSpecific + 567
34 GraphicsServices 0x00007fff2b773db3 GSEventRunModal + 139
35 UIKitCore 0x00007fff24660af3 -[UIApplication _run] + 912
36 UIKitCore 0x00007fff24665a04 UIApplicationMain + 101
37 profile 0x0000000107104be7 main + 72
38 libdyld.dylib 0x00007fff20257415 start + 1
39 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Application windows are expected to have a root view controller at the end of application launch'
terminating with uncaught exception of type NSException
CoreSimulator 732.17 - Device: iPhone 11 Pro Max (120B507B-F47F-4EE3-BBE7-2BC6874FACFD) - Runtime: iOS 14.0 (18A372) - DeviceType: iPhone 11 Pro Max
显然它与 AppDelegate.m 文件有关,更具体地说与didFinishLaunchingWithOptions
函数有关。我说过这样的功能:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];
self.launchOptions = launchOptions;
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
#ifdef DEBUG
[self initializeReactNativeApp];
#else
EXUpdatesAppController *controller = [EXUpdatesAppController sharedInstance];
controller.delegate = self;
[controller startAndShowLaunchScreen:self.window];
#endif
[super application:application didFinishLaunchingWithOptions:launchOptions];
[[FBSDKApplicationDelegate sharedInstance] application:application
didFinishLaunchingWithOptions:launchOptions];
return YES;
}
我尝试了一些解决方案,但到目前为止没有任何效果。
解决方案
推荐阅读
- php - 尝试从数据库填充 DropDown 时 Laravel 错误未定义变量
- function - 如何在 Elm 中部分应用具有所需顺序的函数?
- multithreading - 使用共享队列的 Cpp Contentfunction 线程外
- asp.net-core - 返回到我在 Page 中的确切位置
- dns - 使用我们的邮件服务器,但使用 A 记录将网站转移到多个名称服务器
- python - 读取函数外的变量
- javascript - 输入焦点时按 Enter 键会导致屏幕变为空白
- swift - 在 Swift 中突出显示整个 UICollectionView 部分
- html - 如何从创建者的 IP 地址嵌入 HTML?
- azure - 我们可以通过 c# 代码设置应用程序洞察过滤器属性值吗?