Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 Interface to empty cause the same problem. The iOS 13 system always try to find the Main.storyboard, and failed with crashing message:

*** reason: 'Could not find a storyboard named 'Main' in bundle

Everything is fine on iOS 12 and earlier versions. It looks like a bug in iOS 13.

Does anyone meet same problem? And any solutions?

like image 690
Yun CHEN Avatar asked Sep 19 '19 07:09

Yun CHEN


People also ask

How do I rename the main storyboard in Xcode?

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 .

How do I change the main interface in Xcode?

there is a key in plist file and under "Targets" -> Custom iOS Target Properties "Main storyboard file base name". There default is "Main". So if you want any other storyboard, replace "Main" with your file name. By selecting storyboard from main interface, in plist, it automatically changed.

How do I get to the main storyboard in Xcode?

Select the SingleViewApplication when the templates are presented. Now let's add a button to the app – select the Main. storyboard from the Project Navigator (on the left side of Xcode). Once the Storyboard loads in the center pane, use the Object library to add a button to the storyboard.


1 Answers

Swift 5 with iOS 13

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

enter image description here

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
    }

    //......
}
like image 181
Pratik Sodha Avatar answered Oct 25 '22 05:10

Pratik Sodha