I know this question has been asked before but I have not found a solution to the problem.
I have two ViewControllers in IB and they are connected with a segue I want to fire manually. The segue is connected from the ViewController to the destination ok and the identifier is identical to the one in the code, I have copied and pasted, yet when I try to segue it crashes with 'NSInvalidArgumentException', reason: 'Receiver () has no segue with identifier 'detailLoad''.
- (void)stuff
{
NSLog(#"Tap");
[self performSegueWithIdentifier:#"detailLoad" sender:self];
}
Above is the code I use for the segue, yes I know it's called "stuff" but this is a test project not an actual project.
As i say the segue is named correctly and is all connected properly but it still gives this error as in it cannot find the segue. The project is set up for iOS 6. I have set up NSLogs in prepareForSegue but this is not fired as the error seems to be in the performSegueWithIdentier line.
Any ideas as to why?
Thanks
I had the same problem under iOS 6. I had been invoking the deprecated call presentModalViewController prior to the segue "being lost". Replacing that with the now preferred presentViewControllerAnimated the issue went away.
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.
Trying to move from my first ViewController to my second ViewController (both using same storyboard), using a segue. My first ViewController has two buttons, one that says "Male", one that says "Female" (I know, not everyone associates with one of these two), and I want either, once clicked, to move to the second ViewController. I drag/dropped the button into my code to get the following:
#IBAction func femaleButton(_ sender: AnyObject)
{
Globals.onboardingList.append("girl")
print("it's a girl!")
performSegue(withIdentifier: "femaleSegue", sender: self)
}
The Male button is identical. Using printlines I know that the program works until the "performSegue" line. I added visual segues and put their identifiers as maleSegue and femaleSegue. However, I am getting the following error:
Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[Train.SecondVC
_setViewDelegateContentOverlayInsetsAreClean:]: unrecognized selector
sent to instance 0x7fc482d02b00'
Thanks so much for any help!
In my case I got this error because I had made a custom ViewController class and mistakenly assigned it to the View in the Storyboard instead of the ViewController. Check your Storyboard View and ViewControllers for custom classes and make sure you've set them appropriately.
I can't figure the real problem as i believe you are not using the right identifier or made the segue connection from storyboard from the wrong view controller, however to make sure, please make one segue ctr + click on the button and drag it to the second screen and comment your action, if this works then remove that segue and the previous two segues and do it again but focus this time :)
Simple segue that has worked for months performed with this command:
[self performSegueWithIdentifier:#"ExpirationWarningSegue" sender:self];
now yields this error:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not perform segue
with identifier 'ExpirationWarningSegue'. A segue must either have a
performHandler or it must override -perform.'
What? It's a segue. I command-drag from one UIViewController to another in the storyboard. I'm not writing code for this. The segue is defined in the storyboard with this exact identifier.
Why does this happen now that I have upgraded to xcode 7 when it used to work just fine?
The error message tells you exactly what the problem is:
'Could not perform segue with identifier 'ExpirationWarningSegue'. A segue must either have a performHandler or it must override -perform.'
This is a custom segue. Therefore it must implement perform.
A cool feature of Xcode 7 / iOS 9 is that you can use a custom segue even where you have already specified a push (show) segue or a present (modal) segue. In that case, your perform must call super to get the original behavior.
See my comment here. It is a simple custom segue implementation in objC. Porting it to swift is trivial.
I have a few views embedded in a navigation controller.
I've created a few segues (some from buttons to other view controllers, some from one view controller to another one.
for example I have a segue (Show) from one button to a view controller called name2, when I press the button it works great, but when I try to call it programmatically the app crashes and gives an error.
This is how I call the segue on ViewController1
self.performSegueWithIdentifier("name2", sender: self)
this is from ViewController1 to ViewController2
I also have a segue that is connected not to a button but from vc1 to vc2, gives the same error.
This is the strange error I get:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (ViewController2) has no segue with identifier 'name2''
I tried cleaning the product and also reseting the simulator.
A screen shot of my storyboard
A screen of the identity inspector of viewcontroller1 (it is actually called ViewController in my project)
A screen shot of the segue (name3)
The options of the segue :
Edit:
I found that when I connect a button as an IBAction and then call performSegueWithIdentifier("LogIn", sender: self) from the button it works correctly.
Any help?
Do not connect your Button in Storyboard Editor to the other segue (when you want to call the performWithSegue function within your ViewController1) - just connect the first ViewController to the second One.
Then you can use
self.performSegueWithIdentifier("name2", sender: self)
within your ViewController1 class.
When you set the Segue from one view controller to the other, ensure that you have correctly set the class - see image:
UIStoryBoardSegue was what mine needed.
The error says that you're looking for a segue in ViewController2 but your question states that the segue comes from a button. That would explain why it can't be found.
Try to remove the segue identifier ( name ), build ( cmd + b ), then set the segue identifier and compile. ( in storyboard of course )
Ok the answer is that I'm pretty dumb,
Whenever I was creating new ViewControllers, I was subclassing ViewController which was my first ViewController, instead of UIViewController which made it run recursivly.
I've search almost every related question, but still can not find a clue...
Here is what I did:
1.Create a scrollView using storyboard.
2.Programticaly created 10 myController(which are UITableViewControllers) inside the scrollViewController, So I can use panGesture to switch between tables. and it's working fine.
3.Created a tableViewController using storyboard, set myController to be the corresponding view controller.
4.Embedded the tableViewController in navigation controller.
5.Control drag from tableViewController to a new view controller to create a push segue.
6.Setup segue identifier in storyboard.
The Problem is:
A. When try to segue programmaticaly: use [self performSegueWithIdentifier:#"test" sender:self]; in tableView:didSelectRowAtIndexPath: method.
The exception shows all the time:Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<MyTableViewController: 0x8b413c0>) has no segue with identifier 'test''
B. Than I tried prepareForSegue: but it has never been called.
C. I've checked the segue identifier...there is no problem at all.
What's happening here??? Anyone has any idea???
EDIT:
ScrollViewController and TableViewController are separately created on the same storyboard. no connection/segue between them.
PIC Updated.