4

I am working on an iPad app that does not use a .storyboard interface. My AppDelegate has the following code (in Xcode 8.2.1):

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    window = UIWindow(frame: UIScreen.main.bounds)
    window?.makeKeyAndVisible()
    window?.rootViewController = MyViewController()
    return true
}

I've cleared the Main Interface field from the target as shown below: enter image description here

However, upon running the app, I receive the following crash message:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'Main' in bundle NSBundle

It seems that upon Building/Running the app, the Main Interface field is automatically repopulated with "Main". I've been able to remove this on universal apps, but this is my first, and unsuccessful attempt with an iPad only project. I've tried both pressing Return on the keyboard and clicking outside the field in hopes of saving my Main Interface text field changes, but still have the same result.

My question is: How can I remove the Main Interface from the target and thus avoid this error message?

0

1 Answer 1

21

Check your Info.plist. There should be an entry for the Main storyboard file base name. Delete it there and you should be good to go!

6
  • @MyBikeIsAwesome Always mark answer correct if you find it useful. Feb 27, 2017 at 21:40
  • @TusharSharma. I cannot mark it because it was answered less than 8 minutes ago. Feb 27, 2017 at 21:43
  • What if I want to change the storyboard dynamically?
    – chandru
    Jun 4, 2020 at 8:37
  • @chandru I'm not sure what you mean in the context of this thread. Jun 5, 2020 at 7:59
  • Hi Andre, thanks for your response. Well, Consider. I am having two storyboards Login and Home. One time login scenario. I have to display home storyboard contents if the user have looged in and login storyboard content if he hasn't logged in.
    – chandru
    Jun 11, 2020 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.