SceneDelegate
has supported after iOS 13. If you want to use SceneDelegate
and also want to support iOS prior to iOS 13 then you have to do some changes in your project.
Execute SceneDelegate
if iOS 13 available.
Code:
@available(iOS 13.0, *)
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
//Other code
}
@available(iOS 13.0, *)
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
}
Add UIWindow object in AppDelegate.swift
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
}
For iOS 12 and earlier
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.
var window: UIWindow?
? – Loran