Sandeep Chaudhary
Sandeep Chaudhary

Reputation: 68

Move to next view controller, i am using storyboard

enter image description here

Here is my code

RadarViewController *wc = [[RadarViewController alloc]
                                initWithNibName:@"RadarViewController"
                                bundle:nil];

[self.navigationController pushViewController:wc animated:YES];

Here is the error comes after crashing the app.

The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
 2015-10-14 12:25:02.596 Quick man help[890:60170] *** Terminating    app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/brainpulse/Library/Developer/CoreSimulator/Devices/0FD1A490-11AF-468D-96D3-71F37DDD8552/data/Containers/Bundle/Application/35FDBB50-E294-458B-B367-A57E3FC0B594/Quick man help.app> (loaded)' with name 'RadarViewController''

Upvotes: 0

Views: 63

Answers (3)

NiravPatel
NiravPatel

Reputation: 3260

Do something like below:

  1. Select your RadarViewController in storyboard

  2. In Identity Inspector, give RadarViewController identifier in Storyboard ID. for example "capture" as you can see in screenshot

enter image description here

Now write something like below:

   RadarViewController *obj  = [self.storyboard instantiateViewControllerWithIdentifier:@"youridentifier"];//youridentifier =capture as per screenshot. You can give whatever identifier to  `RadarViewController`

 [self.navigationController pushViewController:obj animated:YES];

Upvotes: 0

virt
virt

Reputation: 27

It seems that not all connections as parts of the archive has been already loaded from the storyboard at the moment you call initWithNibName as same as instantiateViewControllerWithIdentifier. I suggest you to instatiate your view controller in viewDidLoad. If it won't help, try to look if your storyboard is correct. To achieve this open it as a source code and look at opening/closing tags enter image description here

After all of that, delete you view controller and re-add.Don't forget to create a copy of your storyboard before performing all of this.

Upvotes: 0

Mihir Mehta
Mihir Mehta

Reputation: 13833

Your Xcode can not find a xib with name "RadarViewController" because you are using storyboard ....

You need to create instance of RadarViewController from storyboard like

UIStoryboard *mystoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
radarVC = [mystoryboard instantiateViewControllerWithIdentifier:@"radarVCID"];

You need to set radarVCID as storyboardID of RadarViewController in your storyboard

Upvotes: 2

Related Questions