XCode 7: Launch screens may not set custom classnames

Awsed picture Awsed · Aug 7, 2015 · Viewed 32.5k times · Source

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?

Answer

KTPatel picture KTPatel · Oct 10, 2015

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

  • The system loads the launch screen file before launching the app which creates some constraints on what it can contain (some of which may force you back to static image files):
  • The app is not yet loaded so the view hierarchy does not exist and the system can not call any custom view controller setup code you may have in the app (e.g. viewDidLoad)
  • You can only use standard UIKit classes so you can use UIView or UIViewController but not a custom subclass. If you try to set a custom class you will get an Illegal Configuration error in Xcode.
  • The launch screen file can only use basic UIKit views such as UIImageView and UILabel. You cannot use a UIWebView.
  • If you are using a storyboard you can specify multiple view controllers but there are again some limitations. For example you can embed view controllers in a navigation or tab bar controller but more complex container classes such as UISplitViewController do not work (at least not yet).
  • Localizing the launch screen file does not currently seem to have any effect. The base localization is always used so you will probably want to avoid text on the launch screen.
  • You cannot specify different launch screen files for iPad and iPhone. This may be a problem if you have significantly different interfaces for those devices as there is only so much you can do with auto layout and size classes.

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