user1542125
user1542125

Reputation: 615

NSInternalInconsistencyException with programatic storyboard segue

I'm seeing the following error when I trigger my storyboard as pictured below

enter image description here enter image description here

I'm triggering the segue via:

[self performSegueWithIdentifier:@"dayViewDetailSegue" sender:self];

Here's the error I'm getting

'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'UIViewController-4FQ-FK-WrG' and directory 'Main.storyboardc''

What I've tried: opening storyboard as source code, in it I can find the following

<segue destination="4FQ-FK-WrG" kind="presentation" identifier="dayViewDetailSegue" modalPresentationStyle="fullScreen" modalTransitionStyle="coverVertical" id="L8J-7U-DxM"/>

I've tried both a clean and a build directory clean.

Answers to questions by user3182143 - but still having problems

  1. No
  2. I have not renamed the file external to Xcode Class corresponds to a valid class file. I have also tried with no class files declared for the VC in the storyboard.
  3. storyboard file base name = Main
  4. Yes Main.storyboard is in the Copy Bundle Resources. I have also tried removing it and re-adding it.

  5. No ViewControllers are instantiated programmatically in my project.

  6. Correctly linked to appropriate target

    7. I am unable to change this value as it is greyed out. Any advice?

  7. Not adding or changing VC's programatically. This is the first programatic thing I'm doing relating to the storyboard in the project(triggering segue)

  8. Done.

Upvotes: 0

Views: 165

Answers (1)

user3182143
user3182143

Reputation: 9589

Strictly check the following things with your project

  1. Have you renamed your xib or storyboard file outside Xcode? If so, check everywhere you have a reference to it for inconsistencies. Also be sure you respect the uppercase / lowercase letters anywhere you reference the file since is case sensitive.

  2. Go to Interface Builder, select your View1 ViewController > Utilities Panel > Identity Inspector > check if the Custom Class corresponds to your ViewController Class if you have one (.h and .m files).

  3. Check your Info.plist file. If you use storyboads, you should have an entry like Main storyboard file base name and NOT Main nib file base name. If you use nibs, then is vice-versa. Also check that the file base name corresponds with name of the actual file.

  4. Check your target's Build Phases > Copy Bundle Resources and make sure that your xib or storyboard file is added there.

  5. If you instantiate your View1 ViewController programmatically and you use xib file check the nib name for typos (remember, is case-sensitive). Also, if you currently append .xib file format to the name, remove the extension because it shouldn't be used. What I mean is this line of code: UIViewController *controller = [[UIViewController alloc] initWithNibName:@"xibFileName" bundle:nil];

  6. Check the properties of your xib or storyboard file in the file inspector and make sure that your file is linked to your target in the Target Membership selection panel.

  7. Check the properties of the xib or storyboard file in the file inspector and try switching your file Location to Relative to project or Relative to group. See if either way makes a difference.

  8. If you're adding your view controller programmatically in the initWithCoder then you should instantiate it in the viewDidLoad method instead

  9. If nothing from above applies to your situation, you could delete the file from Xcode (select Remove References) and import it again in your project.

Remember to ALWAYS clean your project after making the above changes (SHIFT+COMMAND+K).

CHOICE 2

Your Class name in Storyboard was wrong.So Please delete and add again the class name in storyboard.

Upvotes: 2

Related Questions