[英]Failed to instantiate the default view controller after switching from .xcodeproj to .xcworkspace
When I create a brand new project in Xcode and choose Storyboard for the interface, I can run the app on my phone just fine.当我在 Xcode 中创建一个全新的项目并为界面选择 Storyboard 时,我可以在手机上运行该应用程序。
However, when I do pod install
(the only deps I added are pod 'Plaid'
) and then switch over to the .xcworkspace file, I get this error:但是,当我执行
pod install
(我添加的唯一 deps 是pod 'Plaid'
)然后切换到 .xcworkspace 文件时,我收到此错误:
[WindowScene] Failed to instantiate the default view controller for UIMainStoryboardFile 'Main' - perhaps the designated entry point is not set?
I have tried the usual fixes (check Is Initial View Controller etc.)我已经尝试了通常的修复(检查是初始视图控制器等)
Appreciate any help, thanks.感谢任何帮助,谢谢。
You must assign entry point to your project, go to your sceneDelegate file and set it like this:您必须为您的项目分配入口点,转到您的 sceneDelegate 文件并将其设置如下:
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: windowScene)
window?.backgroundColor = .white // or the color that you prefer
window?.makeKeyAndVisible()
let controller = ViewController() // or the first controller presented in your app
window?.rootViewController = controller
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.