Search code examples
iosxcodeios13

Info.plist configuration "(no name)" for UIWindowSceneSessionRoleApplication


I am getting the below warning and the app shows a black screen for iOS 13

[SceneConfiguration] Info.plist configuration "(no name)" for UIWindowSceneSessionRoleApplication contained UISceneDelegateClassName key, but could not load class with name MyApp.SceneDelegate.

How can I resolve this issue?


Solution

  • 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.