I'm getting Thread 1 SIGABRT in my AppDelegate class with the following
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController
loadView] instantiated view controller with identifier
"UIViewController-ynt-fo-t3z" from storyboard "Main", but didn't get a
UITableView.'
Storyboard arrangement:
UIViewController --> UITableViewController
I'm using a menu Button item from UIViewcontroller to trigger the segue. I have tried everything including preparedforSegue method. The only way around is to change the target view controller back to UIViewController while implementing UITableViewDelegate and UITableViewDataSource which I'm not too fond of using. Any solutions to my madness?
I had a similar issue long time ago; I tried anything, and nothing worked. I ended up using a new UITableViewController and segueing to it; And the issue was resolved. (it seemed like a bug in Xcode or something)
Do the same and see if it works for you.
Related
performSegue(withIdentifier: "m1", sender: self)
The code above is correct here below but it's giving me a SIGBRT (*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'm1'') error claiming the receiver login has no segue with identifier 'm1''
even the login is segued correctly to the UITabBarController with the correct identifier. Forgive me, i'm a beginner developer.
enter image description here
The call to perform the segue must be in the initial view controller, not the destination view controller. In this case, self.performSegue(withIdentifier:"m1", sender:self) should be in the UIViewController, and NOT the UITabBarController.
I've already spent the whole day in an issue and did not find a solution yet. I have a UITabBarViewController and I am trying to fire off a modal segue from one of its tabs. I've already created the view I want to segue to, created the segue itself (from the tab's view controller to the target's view controller) and the identifier. In order to test my segue I created a UIButton in my tab and wrote the following code on its action:
[self performSegueWithIdentifier:#"showProductInfo" sender:self];
The modal segue worked fine. But if I try to write the same code to be performed somewhere else (inside a specific method that is called after I receive a web service response) the segue simply does not work. I get the following error:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'showProductInfo''
This is driving me crazy! Any help is more then welcome.
Editting:
Some additional findings:
If I take off the performSegue from the method I am currently using (which by the way is called by DidFinishLoading) and put it on ViewDidLoad the segue is performed successfully.
Thinking that it could be a thread related issue I included the performSegue inside a dispatch_async(dispatch_get_main_queue()... But the error is the same !
If your destination viewcontroller is inside a navigationcontroller, then take a look at this question:
http://stackoverflow.com/questions/8041237/how-to-set-the-delegate-with-a-storyboard
Furthermore, from the error it looks like the segue you are trying to perform is not attached
to the viewcontroller you are starting from. So,Try to remove the seque and drag it from the
viewcontroller.
The current view controller must have been loaded from a storyboard. If its storyboard property is nil, perhaps because you allocated and initialized the view controller yourself, this method throws an exception.
Make sure you have Storyboard ID for your destination VC (in this example myViewController).
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:#"myStoryboard" bundle:[NSBundle mainBundle]];
UIViewController *myViewController = [storyboard instantiateViewControllerWithIdentifier:#"MyController"];
[self.navigationController pushViewController:myViewController animated:YES];
I'm creating an application that first loads a settings screen which displays a series of text fields and labels asking the user for input. This is all working fine.
What I then want to do is once this data has been input, it comes up with the main application interface.
What is happening though is that when I'm telling the application delegate to load the main view, it says that the viewController isn't key value complaint for the key delegate.
The code I'm using to create the viewController is:
CustomViewController *viewController = [[CustomViewController alloc] initWithNibName:#"CustomViewController" bundle:nil];
self.window.rootViewController = viewController;
If anyone thinks that UIWindow doesn't have a rootViewController property, please check the documentation. That's what I did, and it does have one.
Any help with figuring this out would be greatly appreciated.
For those that like full debug info, this is what I get from xcode.
2011-06-18 15:03:15.474 Some App[15596:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<CustomViewController 0x53368b0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key delegate.'
Thanks,
Matt.
Most likely you try to use delegate somewhere in your xib file, but it doesn't exist in your CustomViewController class.
Check the connections in your nib file and remove the one that connects to the non existing delegate.
The rootViewController property was only recently introduced and might not be available on devices running an older version of iOS.
You want to have a UINavigationController as the root view controller of your application and subsequent pages you simply push onto it. If you don't want animation, then do animate:NO. If you don't need a navigation bar, then hide that as well.
It is generally preferable to use one of the existing container view controllers over swapping them out yourself.
I'm currently developing a tab bar based application with 5 tabs that have an UITableView each. Each tab is linked to a normal UIViewController, the first two with the ones that xCode creates by default and the others with the ones I created.
If I try to add a table view to the first two view controllers (default ones) everything works smoothly, but when I do the same with the others, the app crashes telling me that:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0x4e2f6f0'
and the tableView:numberOfRowsInSection: in my .m file is this:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 2;
}
do you now any solution ? I've looked around with no result
thanks in advance for answers
Check those two things.
1) if your other viewControllers are subclasses of UIViewController then they should implement the delegate methods:UITableViewDelegate and UITableViewDataSource. Meaning it is not only required to implement them in your code but to tell the compiler that you will.
#interface thirdViewController : UIViewController <UITableViewDataSource, UITableViewDelegate>
2) or try to see if your viewController is of type UITableViewController.
#interface thirdViewController : UITableViewController
I have a UIViewController I am loading from a xib file and pushing onto the navigation controller stack.
In the header file for the View Controller, I have:
IBOutlet UILabel *myTitle;
I don't do anything with "myTitle" in the code yet; I was just setting up the connections.
When I compile and run the application, and there are no labels defined in the xib file (and thus, nothing attached to the IBOutlet), it works. The view controller animates into view just fine, showing the view I built in Interface builder.
If I add a label to the xib in the interface builder, but don't connect it to the outlet, and recompile, it still works, showing the label with the default text I entered for it.
But if I connect the IBOutlet myTitle to the label in interface builder, recompile, and run the app, it works fine until I try to push the view controller onto the navigation controller's stack, at which point I get a crash:
*** -[UILabel copyWithZone:]: unrecognized selector sent to instance 0x4558e20
If I disconnect the outlet again, it resumes working, showing the static label as before. It appears that there's something funky going on when the view gets displayed, because the crash happens when I push the view onto the navigation stack.
Am I not supposed to add an IBOutlet to a UILabel or something? Or is there something else going on? Any suggestions on where to look for trouble?
Yes, it could be caused by wrong param name, e.g. try this:
IBOutlet UILabel title;
and it'll call an exception like that:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UILabel copyWithZone:]: unrecognized selector sent to instance 0x143f520'
Did you create an accessor for your IBOutlet?
#property (assign) IBOutlet UILabel *myTitle;
And then, in your .m file
#synthesize myTitle
I had the same problem. Turns out *title is reserved and Xcode doesn't tell you this. Once I renamed it to something else it worked.
In my case I had a UILabel in a UIToolBar. What fixed it for me was to delete the toolBar and add a new one with a new UILabel. An IB bug.