Info.plist UIWindowSceneSessionRoleApplication 的配置“(无名称)”
Info.plist configuration "(no name)" for UIWindowSceneSessionRoleApplication
我收到以下警告,应用程序显示黑屏 iOS 13
[SceneConfiguration] Info.plist
configuration "(no name)" for UIWindowSceneSessionRoleApplication contained UISceneDelegateClassName key, but could not load class with name MyApp.SceneDelegate.
如何解决这个问题?
SceneDelegate
在 iOS 13 之后支持。如果您想使用 SceneDelegate
并且还想在 iOS 13 之前支持 iOS 那么您必须在您的项目中做一些更改。
如果 iOS 13 可用,则执行 SceneDelegate
。
代码:
@available(iOS 13.0, *)
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
//Other code
}
@available(iOS 13.0, *)
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
}
在 AppDelegate.swift
中添加 UIWindow 对象
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
}
对于 iOS 12 及更早版本
AppDelegate needs a UIWindow property. iOS 13 uses SceneDelegate in
new projects. Specify the UIWindow
object and remove the
SceneDelegate.swift
file.
If you have removed the SceneDelegate
from the project, then you must
remove the Application Scene Manifest dictionary from Info.plist.
如果除默认场景外没有使用自定义场景,请从 Info.plist 中删除 'UISceneClassName'。
<key>UISceneClassName</key>
<string></string>
我收到以下警告,应用程序显示黑屏 iOS 13
[SceneConfiguration]
Info.plist
configuration "(no name)" for UIWindowSceneSessionRoleApplication contained UISceneDelegateClassName key, but could not load class with name MyApp.SceneDelegate.
如何解决这个问题?
SceneDelegate
在 iOS 13 之后支持。如果您想使用 SceneDelegate
并且还想在 iOS 13 之前支持 iOS 那么您必须在您的项目中做一些更改。
如果 iOS 13 可用,则执行 SceneDelegate
。
代码:
@available(iOS 13.0, *)
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
//Other code
}
@available(iOS 13.0, *)
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
}
在 AppDelegate.swift
中添加 UIWindow 对象class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
}
对于 iOS 12 及更早版本
AppDelegate needs a UIWindow property. iOS 13 uses SceneDelegate in new projects. Specify the
UIWindow
object and remove theSceneDelegate.swift
file.If you have removed the
SceneDelegate
from the project, then you must remove the Application Scene Manifest dictionary from Info.plist.
如果除默认场景外没有使用自定义场景,请从 Info.plist 中删除 'UISceneClassName'。
<key>UISceneClassName</key>
<string></string>