从.xcodeproj切换到.xcworkspace后,未能实例化默认视图控制器



当我在Xcode中创建一个全新的项目并选择Storyboard作为界面时,我可以在手机上运行该应用程序。

然而,当我执行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?

我已经尝试了通常的修复(检查是初始视图控制器等(

感谢您的帮助。

您必须为您的项目分配入口点,转到您的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
}

最新更新