I\'m getting a strange error: \'Could not find a storyboard named \'Main\' in bundle NSBundle\'
when trying to run my app on a real iOS device.
I have
I got this error, however, it was my intention to remove storyboards completely.
Removing the 'Main Storyboard file base name' key from my plist cured the error.
open the info.plist of your project and remove the selected row displayed in screenshot
If you get a black screen ensure your new initial storyboard is selected as your main interface
For anyone facing this issue on Xcode 11, here's how you fix it if you face this issue when doing storyboard less project setup
(Adding some parts that ricardopereira missed)
1) First, delete the Main.storyboard file
2) Next, go to PROJECT_NAME -> GENERAL
In main interface drop-down, delete the text Main
3) Now go to info.plist and delete Storyboard Name
4) Finally, modify scene(_:willConnectTo:options) code in the file SceneDelegate.swift (Yes! It's not in App Delegate anymore.)
var window: UIWindow?
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(frame: windowScene.coordinateSpace.bounds)
window?.windowScene = windowScene
window?.rootViewController = ViewController()
window?.makeKeyAndVisible()
}
You can also refer to this video instead: https://www.youtube.com/watch?v=Htn4h51BQsk
This error come, while you recover your main.storyboard file from trash after delete your file. I also faced same issue yesterday.
You have to set the location path of the main.storyboard as Relative to Group in file inspector of main.storyboard. After that in the same attribute, you have to insure the check mark on your app target(As you can see in attached picture).
Two different solutions that worked for me after upgrading to Xcode 10.1:
In File->Workspace (or Project) Settings. Switch to Legacy Build System.
In your targets Build Phases, remove the Base.lproj folder from Copy Bundle Resources (if listed) and make sure each of your storyboards are listed and copied separately instead.
After applying either of the fixes above make sure you Clean Build Folder from the Product menu once, otherwise the fixes might not work properly.
As Kalpit Gajera has said, "open the info.plist of your project and remove the selected row displayed in screenshot". You simply remove 'Main storyboard file base name' from the Info.plist. After you remove it, clean and run, the program will no longer fail but will show a black screen. Open Info.plist again and manually add the row back in. Problem solved.