I have a tabbar ios application. I put (embed) NavigationController in one of the viewcontroller,then added one button and one new viewcontroller to pass. I dragged from button in first vc to new vc and select "push".
But following error message is thrown when I tab the button :
Terminating app due to uncaught exception 'NSGenericException', reason: 'Push segues can only be used when the source controller is managed by an instance of UINavigationController.'
I really don't understand because I have already a navigation controller and also not added any additional code yet.
Thanks for any help.
You may not use push segue with a button that you have created yourself. Try using Modal segue instead.
Related
I'm getting this follow message when I try open a table item in my 'add' form to update it.
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'verBeneficioSegue''
Github with project: https://github.com/felipeejunges/MyBenefits
Segue:
My code:
When I was debbuging I got error in line 58.
P.S. I'm doing a project exercise for my post-degree in iOS.
I try to clean up project, restart Xcode, restart my Mac, but nothing worked.
From the crash the segue is inside vc named ListarBeneficiosTableViewController
ListarBeneficiosTableViewController: 0x7fbf6d510340>) has
no segue with identifier 'verBeneficioSegue'
and your vc shown in picture is named MyBeneficio ( it's a UITaBarController ) which isn't the same hence the crash
If your purpose is to add another tab to the tabs controller you should drag the segue from the tab to the listoVC and select viewControllers from the popup
Otherwise the segue origin should be ListarBeneficiosTableViewController and it's destination is another vc
You are saying
self.performSegue(withIdentifier: "verBeneficio", sender: beneficio)
in your ListarBeneficiosTableViewController class. This implies that your ListarBeneficiosTableViewController instance is loaded from the storyboard and in the storyboard it has a segue called "verBeneficio".
Okay, so let's look in the storyboard. When we do, we see that the "verBeneficio" segue does not come from the ListarBeneficiosTableViewController. It comes from the tab view controller.
I segue from one Storyboard where the View Controller is written in Objective C to another Storyboard where the View Controllers is written in Swift 2 and it goes through fine.
However, when I click fire the next segue in the second Storyboard, I get the following error:
*** Terminating app due to uncaught exception 'NSGenericException', reason: 'Could not find a navigation controller for segue 'record'. Push segues can only be used when the source controller is managed by an instance of UINavigationController.'
This is the code that calls the next segue in Swift 2
self.performSegueWithIdentifier("record", sender: nil)
The initial view in the second Storyboard is embedded in a Navigation Controller as well.
Also worth noting, I tried without the first storyboard and my app going directly to the second storyboard, and it finds the segue fine.
Any ideas on what could be causing the problem?
Choose the segue, go to its Attributes inspector and change the Kind from push to Modal. Let the presentation and Transition remain default.
This will work fine for you.
But if you want the segue of kind 'Push' then the first View controller which is written in Objective-C should be embed in Navigation Controller.
I have a app project I am working on. I created an unwind segue in my main view as
#IBAction func unwindToHomeScreen(segue:UIStoryboardSegue) {
}
It works from another view from the cancel button
however in the same view when I call the segue
self.performSegueWithIdentifier("unwindToHomeScreen", sender: self)
The app crashes with
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<TravelSave.AddVacationTableViewController: 0x7907f380>) has no segue with identifier 'unwindToHomeScreen''
Any suggestions?
Although you say in your comment, that you've "created the segue programmatically," from the screen cap you've posted in your question, it's clear that you've appropriately linked the segue to your cancel button within the storyboard. Within your storyboard, you need to add an identifier. Select the segue within the view controller scene, then add "unwindToHomeScreen" as an identifier:
The problem I was having was when I attached my Cancel button to my exit segue I did not put the identifier on the segue shown here
I am using a Storyboard for the first time.
Here is a picture:
My app is a TabBar application. From the 'Main' screen I have a settings button, which I would like to connect to the SettingsViewController, which I have embedded in a Navigation Controller (because it has to continue in that manner - to other parts of the settings screen).
Another picture:
NOW: I have tried connecting the settings button (command+control drag) to the controller (modal segue)= CRASH. Tried to connect the settings controller (modal segue) = CRASH.
Tried programmatically : creating an IBAction for the settings button an then calling the settings VC, but that crashes too.
Note: This app has many many more screens, but they all work fine. It's just the connection to the Settings VC that Is crashing the app.
Any ideas would be appreciated.
Here is the error log:
So you get the error:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason:
'-[UITableViewController loadView] loaded the "Eab-23-IvL-view-eGY-e2-X6m" nib but didn't
get a UITableView.'
Which means that your Settings View Controller, which inherits from UITableViewController, does not have an actual UITableView in the storyboard. A fix that will definitely work is to just remove the settings view controller from the storyboard and then drag a Table View Controller in place of the one you removed. Then just proceed to give it the right class in the identity inspector and set back up all of the segues and connections!
You're using UIToolBar when there is a proper way to handle it, with UINavigationBar.
Then you can set a button, connect the button to settingViewController (control+drag), then choose modal, set a name to the segue, also control+drag the bar button item to your viewController and connect like this:
- (IBAction)btnSettings:(id)sender {
[self performSegueWithIdentifier:#"settingsSegue" sender:sender];
}
Then it should work.
I just created a calculator app with storyboards using two views. I started my simulator, and everything worked fine at first. On the first screen, I was able to use the "Calculator" button to switch to the second screen, and on the second screen I had a button to go back to the main menu. But when I switched from the main menu back to the calculator a second time, the app crashed, and the following error occurred:
2013-02-21 20:55:36.556 CTS Calculator[22637:c07] * Terminating app
due to uncaught exception 'NSGenericException', reason: 'Could not
find a navigation controller for segue 'To Calculator'. Push segues
can only be used when the source controller is managed by an instance
of UINavigationController.'
* First throw call stack: (0x15a9012 0x12b6e7e 0x650f31 0x642b99 0x642c14 0x12ca705 0x1fe2c0 0x1fe258 0x2bf021 0x2bf57f 0x2be6e8
0x22dcef 0x22df02 0x20bd4a 0x1fd698 0x260bdf9 0x260bad0 0x151ebf5
0x151e962 0x154fbb6 0x154ef44 0x154ee1b 0x260a7e3 0x260a668 0x1faffc
0x1ecd 0x1df5) libc++abi.dylib: terminate called throwing an exception
(lldb)
I am not sure why this did not happen the first time I pushed the calculator button. I have a custom segue transition going back to the menu, but not from the menu to the calculator. My navigation controller is set up fine, I believe. Any ideas what the problem might be?
Error shows you dont have a navigation controller. and you are setting segue style to push. Change the segue style to modal and give a try.
Yes. You can use push then the root view controller should be a navigation controller.
Check these links
Adding a Navigation Controller to a Storyboard
Use Storyboards to Build Navigation Controller and Table View