Launch screens may not set custom classnames

IosSwiftXcodeUitableview

Ios Problem Overview


I tried to add a custom class to my Table View Cell, but after I added it it gives the following error:

enter image description here

I often read that I can't use custom classes in the LaunchScreen but I haven't touched this file. Can anyone help me?

enter image description here

This are my general settings for the main and the launch interface.

I am using Swift.

Ios Solutions


Solution 1 - Ios

Go to the properties of your Main.storyboard and check that Use as Launch Screen isn't selected. It sounds like you have selected it by mistake.

enter image description here

Solution 2 - Ios

iOS 13 note:

Prior to iOS 13, you had both:

  • Main.storyboard
  • LaunchScreen.storyboard

Starting from iOS 13 by default you have SwiftUI. As a result you no longer have the Main.storyboard. You only have LaunchScreen.storyboard.

As for their differences see here

And perhaps like me, you just saw the word storyboard and jumped right at it and later realized you're not building against Main.storyboard.

The fix is simple and is mentioned in Paulw11 answer

Why that has happened?

It's because SwiftUI has somewhat deprecated the need of storyboards and tends to put focus on using previews as a single source of truth.


If you still want to work with the storyboard then what you have to do is upon creating the project set the 'User Interface' to 'Storyboard':

enter image description here

Solution 3 - Ios

I always have a separate splash screen which is the first view controller app loads. Splash Screen Storyboard

This is the file where you want to add all the business logical or display spinner / loader etc.

For this to work you have to setup Deployment target of your project as shown. Target Deployment info

Note that you can not add any other custom class to LaunchScreen. It is an ViewController to just show while app is about to start. In this phase of app life cycle nothing has yet been started. Its almost similar to static image ( It used to be only static image till iOS7 ). Starting for iOS9 or XCode 7 only it was changed to storyboard previously it used to be XIB file. Hence you can not add custom class objects to LaunchScreen as this is a phase where app is still to be loaded or started.

Solution 4 - Ios

To add on to Yash's comment, this error is misleading. If the Custom Class field is empty for your ViewController then you should also check every object on your view and see if their custom classes are empty as well, you can't even have a custom label set for the Launch Page.

This is what got me and took me a while to figure out, had a custom class set on one of my labels by accident from a cut + paste.

Solution 5 - Ios

I made the same mistake.

WRONG:

enter image description here


Very likely what you intended to do was such:

CORRECT:

enter image description here

Solution 6 - Ios

There are many reasons for this error.

I got this error because launchscreen.storyboard and main.storyboard had same custom class as "viewController.swift".

Try removing the custom class from launchscreen.storyboard.

Solution 7 - Ios

Go to your -> launchScreen.storyboard then got to your -> identity and types -> uncheck the box -> use as launch Screen. 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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGenfoodView Question on Stackoverflow
Solution 1 - IosPaulw11View Answer on Stackoverflow
Solution 2 - IosmfaaniView Answer on Stackoverflow
Solution 3 - IosBishal GhimireView Answer on Stackoverflow
Solution 4 - IosWilliam T.View Answer on Stackoverflow
Solution 5 - IosmfaaniView Answer on Stackoverflow
Solution 6 - IosJobLessView Answer on Stackoverflow
Solution 7 - IosmakhiyeView Answer on Stackoverflow