Cannot change Main.storyboard's name on iOS 13 [Xcode 11 GM seed 2]

前端 未结 2 803
春和景丽
春和景丽 2021-01-13 20:30

On iOS 13 simulator with Xcode 11 GM seed 2, the app crashes after Main.storyboard\'s name changed (Info.plist changed also). Setting option Main Interfac

相关标签:
2条回答
  • 2021-01-13 21:10

    Change the Main storyboard file base name from Info.plist after you changed the name of Main.storyboard.And of course,you can change it from General-Deployment info-Main Interface.

    0 讨论(0)
  • 2021-01-13 21:25

    Swift 5 with iOS 13

    One more changes require in info.plist file under Application Scene Manifest group.

    Change name in Application Scene Manifest also.

    Additional:
    If you want to create the root window without a storyboard on iOS13, you need removing the Main storyboard file base name and Storyboard Name item from Info.plist, and then create the window programmatically in SceneDelegate:

    class AppDelegate: UIResponder, UIApplicationDelegate {
        func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
            // Override point for customization after application launch.
            if #available(iOS 13.0, *) {
                //Do nothing here
            } else {
                window = UIWindow(frame: UIScreen.main.bounds)
                window?.makeKeyAndVisible()
            }
    
            return true
        }
    }
    
    class SceneDelegate: UIResponder, UIWindowSceneDelegate {
    
        var window: UIWindow?
    
        @available(iOS 13.0, *)
        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)
            // continue to create view controllers for window
        }
    
        //......
    }
    
    0 讨论(0)
提交回复
热议问题