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
If still you have black screen, then try adding below code in your scene delegate
willConnectTo
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(frame: windowScene.coordinateSpace.bounds)
window?.windowScene = windowScene
let navController = UINavigationController()
let mainstoryboard:UIStoryboard = UIStoryboard(name: "Your storyboard name", bundle: nil)
let initialController = mainstoryboard.instantiateViewController(withIdentifier: "your initial controller Identifier") as! initialController
navController.addChild(initialController)
window?.rootViewController = navController
window?.makeKeyAndVisible()
I was moving Main.Storyboard file to "blue" sub folder which was causing issues, I had to add sub folders following these instructions Xcode 6.3 New File Issue
then moving Main.Storyboard file to yellow sub folder did work for me
In my case, I forgot to change Storyboard Name
in Info.plist
Info.plist
source code
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>AccountViewController</string>
</dict>
</array>
</dict>
</dict>
Follow the steps:
1) First Click your story board
2) Then Click File Inspector
3) Then select "Target Membership"
I deleted the app from my phone, did Product-->Clean, and loaded it again. That's all it took for me.