gpt4 book ai didi

xcode7 - 使用 Xcode 7、iOS 9 运行项目时出现 "Application windows are expected to have a root view controller at the end of application launch"错误

转载 作者:行者123 更新时间:2023-12-03 05:07:36 24 4
gpt4 key购买 nike

运行函数后

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

发生崩溃:

 Assertion failure in 
-[UIApplication _runWithMainScene:transitionContext:completion:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', `enter code here`reason: 'Application windows are expected to have a root view controller at the end of application launch'
*** First throw call stack:
(
0 CoreFoundation 0x0000000109377885 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000108df0df1 objc_exception_throw + 48
2 CoreFoundation 0x00000001093776ea +[NSException raise:format:arguments:] + 106
3 Foundation 0x0000000108a42bb1 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
4 UIKit 0x000000010760e350 -[UIApplication _runWithMainScene:transitionContext:completion:] + 2875
5 UIKit 0x000000010760b73f -[UIApplication workspaceDidEndTransaction:] + 188
6 FrontBoardServices 0x000000010b87fd7b FrontBoardServices + 163195
7 FrontBoardServices 0x000000010b880118 FrontBoardServices + 164120
8 CoreFoundation 0x00000001092a20f1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
9 CoreFoundation 0x0000000109297eac __CFRunLoopDoSources0 + 556
10 CoreFoundation 0x0000000109297363 __CFRunLoopRun + 867
11 CoreFoundation 0x0000000109296d78 CFRunLoopRunSpecific + 488
12 UIKit 0x000000010760b091 -[UIApplication _run] + 402
13 UIKit 0x000000010760f79b UIApplicationMain + 171
14 bbwc 0x00000001037a9998 main + 344
15 libdyld.dylib 0x000000010a45ca05 libdyld.dylib + 10757
16 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

这个项目是一个旧项目,我应该怎样做才能使其在 Xcode 7 和 iOS 9 上构建并运行?

最佳答案

根据您的错误消息:

Application windows are expected to have a root view controller at the end of application launch

这个“旧”项目有多少年了?如果超过几年,你还有:

[window addSubview:viewController.view];

您应该将其替换为:

[window setRootViewController:viewController];

关于xcode7 - 使用 Xcode 7、iOS 9 运行项目时出现 "Application windows are expected to have a root view controller at the end of application launch"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30884896/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com