Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Launch screens may not set custom class names"

I'm trying to set the initial view controller to a custom class. In previous versions this worked but for some reason I cannot do it now.

I have a UIViewController class (IntroVC). In the storyboard I created a new View Controller object and set it's class (Identity Inspector -> Custom Class -> Class) to IntroVC. IntroVC is a .swift file with functions viewDidLoad() and didReceiveMemoryWarning() of class IntroVC: UIViewController.

Here are screenshots of XCode

Error

Error

IntroVC

IntroVC

Storyboard

Storyboard

Anyone know how to solve this? What's up with this version of XCode?

like image 499
Ty Pavicich Avatar asked Oct 01 '15 03:10

Ty Pavicich


2 Answers

I made a really simple mistake.

This error occurred when a custom class was set in LaunchScreen.storyboard. I should have set my custom IntroVC class in Main.storyboard.

Setting the initial VC class in LaunchScreen.storyboard to UIViewController and the initial VC class in Main.storyboard to IntroVC fixed the problem.

XCode 7.0.1 is fine. The mistake is my own.

like image 195
Ty Pavicich Avatar answered Sep 28 '22 10:09

Ty Pavicich


Go through your View Controllers in Main.storyboard and make sure you don't have one that is both set to a custom class:

enter image description here

and has "Is Initial View Controller" checked:

enter image description here

You can only do one or the other. Somehow I had "Is Initial View Controller" still checked by mistake, and it took me a while to hunt that down!

like image 43
Josh Avatar answered Sep 28 '22 10:09

Josh