PerformSegueWithIdentifier

Hello all, I have an unusual problem cannot figure out.


After a UIAlertView is displayed to user a button will perform segue to another scene. The scene I am segueing from is in the View my connection is from my originating VC to my Destination VC ctrl click drag put the identifier in.


When I tap the ok button the app crashes with the following error.


*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<LoginView: 0x1505e62c0>) has no segue with identifier 'gohome''


Why does the error say Receiver <LoginView:> when it is Not The Receiving VC it is the Sending VC ? Unless I have never noticed that phrase.


Does not make any sense to me, I have no other VC with the same name I have made these connections 100's of times. They are even in my app now working. The ViewController which I am trying to segue from has a NavigationController too.


I could attach images but my connections are 100% I have run out of ideas !!


Please help if you have any suggestions.

Regards

JZ

In that context, Receiver means the object receiving the PerformSegueWithIdentifier message, in your case an instance of the LoginView class.

When the button is tapped, you are probably doing somthing like:

[self PerformSegueWithIdentifier:@"gohome" sender:nil]; // obj-c
// or
self.PerformSegueWithIdentifier("gohome", sender: nil) // Swift

So self (an instance of the LoginView class) is receiving the "PerformSegueWithIdentifier" message.

Based on the error message, either the segue is not named "gohome", or it is not connected properly.

Is LoginView a view controller? Kinda strange name you have there.... I'm going to guess yes.


My best guess, since you know how to do segues, is that you simply have a typo. Open up the storyboard again and click on the segue and see what the name is. Did you use goHome for example (capital H) in storyboard but all lower-case in the code?

okay the spelling may be a mistake , I was sure I checked it. Must look again.

WOnt be be able to check till tomorrow.


THanks guys for the input.


JZ.

THanks for the info now receiver makes sense. I wil check the name again. And I connected by ctrl click drag and connect. Have done this 100's of times this why I am getting frustrated. This is supposed to be the easy stuff. Lol.


THanks for for the input.


Jz

Take care of caps as well. goHome is different from gohome.

Okay guys , thanks so much for the help. But still have this issue. It appears that Extra characters are being added in the segueIdentifier.. Take a look at this. Also I checked all spelling caps and all is good.


Take a look at the segue with identifier Quotes.. And below that is my Segue from the class.


*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (<LoginView: 0x1541aa2c0>) has no segue with identifier 'segueScan''

[self performSegueWithIdentifier:@"segueScan" sender:self]; Also tried [self performSegueWithIdentifier:@"segueScan" sender:nil]

I even tried to go around this and use a UIButton .. the button works fine with changing scenes. So i thought I hide it and show it after my Alert was displayed and tapped. But !!! the button is hiddin in the ViewDidLoad but it is Not Reveiled after UIAlert is tapped.

self.gotoScanVC.hidden = YES; is in my ViewDidLoad

And

self.gotoScanVC.hidden = NO: is in my UIAlertAction

So by now you could imagine I am loosing it !! 🙂 lol...

I have a normal UIViewController from where I am controlling the button and the segue it has some UILabels and UIImages in it.. Thats it.

I even tried removing my NavigationController and putting it back And get the same results.

?? Not sure if any of this extra info will help you or me find the issue, But thanks in advance.

Xcode 7.2.1 El Capitain 10.11.3 With No Updates Available. I just checked.

Regards

JZ

What extra character ?


Do you refer to :

'segueScan''


which seems normal (I add spaces to make it clearer):

'segue' ' : the first single quote is the closing quote to 'segue, second single quote is the closing quote for 'Receiver, isn't it ?

Hi again, Yes sorry I did not see the 'Receiver quote. Yes you are correct.


I just finished removing all ViewControllers and replaced them with new ones .. For some reason iOS does not want to recognize the segue connection, for this one VC going back in sequence. All other segues are working properly.


JZ

Did you check:


- in the storyboard that bthe segue effectively links the 2 controllers you want to connect ?

- that segue attributes are what they should be ?


- Your perpeareForSegue function if any


Can you track on debugger the exact crash location ?

Also, do a search on gohome in your whole project, to see where you reference the segue ; may be you have an unwanted reference left somewhere ?

What do you mean by segue going back ? Is it an unwind segue ?

PerformSegueWithIdentifier
 
 
Q