I created a simple application using Xcode 7 Beta 2. The application simply contains class MyAppDelegate
, MyViewController
, MyMain.storyBoard
and MyLaunchScreen.storyboard
. After recompiling the application with Xcode 7 Beta 4 the error "Launch screens may not set custom classnames" appears. Any suggestions?
Hence you can not add custom class objects to LaunchScreen as this is a phase where app is still to be loaded or started. To add on to Yash's comment, this error is misleading.
After your app is loaded it will be replaced with your app’s first screen after which the user can start using your app. Xcode creates a storyboard by default which you can use to set up your loading screen. Although this works fine in most cases, there are exciting new options available in Xcode 12 and iOS 14.
Changing it in General -> App Icons and Launch images -> Launch Screen File drop down -> LaunchScreen instead of launchScreen.storyboard won't help (stop) do the above. make sure all your constraints are set properly easier way just copy the constraint settings from your main story board. Thanks for contributing an answer to Stack Overflow!
Using a storyboard (default) The list of plist configuration options are new in Xcode 12 and allow you set up a launch screen without the use of storyboards. This is great for SwiftUI apps in which it’s kind of ugly to still have a storyboard file for your “splash page”.
Note that the launch screen is not a fully customizable view controller. You cannot specify a custom class name in the storyboard and expect the system to give you the option to execute code at this stage by calling viewDidLoad. Remember, the app hasn’t launched yet.
Launch Screen Constraints
If you are deploying to iOS 7 you will still need to include the static launch image files. You can include both a launch screen file and static launch images. Devices such as the iPhone 6 running iOS 8 will use the launch screen file whilst iOS 7 devices will fallback to the launch images.
For more details please click here
This is a simple answer, but something I did and didn't even know it. I think with iOS 7, there is now a main.storyboard and a launchscreen.storyboard. I was unwittingly trying to build my initial functional screen on the launch screen.storyboard. That's a no no.
Hope this helps and happy coding!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With