在SceneDelegate.swift
以下代码中返回错误消息“使用未解析的标识符‘ContentView’;您的意思是‘ContentMode’吗?”。
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options
connectionOptions: UIScene.ConnectionOptions) {
let window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = UIHostingController(rootView: ContentView())
self.window = window
window.makeKeyAndVisible()
}
Run Code Online (Sandbox Code Playgroud)
此错误会导致程序构建失败。令人惊讶的是,当我创建一个完全相同的新项目时SceneDelegate.swift
,ContentView 没有问题。
如果我将 ContentView 更改为 ContentMode,它会返回错误“ContentMode”无法构造,因为它没有可访问的初始值设定项”。
其他人遇到过这个问题吗?只是好奇我应该从哪里开始寻找或我做错了什么。
想通了这一点。如果其他人好奇,我更改了ContentView.swift
文件名,但没有在SceneDelegate.swift
.
所以,如果你改变了ContentView.swift
文件,BetterNameView.swift
你需要更新上面的代码SceneDelegate.swift
来自ContentView()
于BetterNameView()
归档时间: |
|
查看次数: |
2539 次 |
最近记录: |