0
votes

I have a show segue between two ViewControllers in my Storyboard. When call performSegueWithIdentifier:, I get an NSInvalidArgumentException:

Receiver (<[MY VIEWCONTROLLER SUBCLASS]: 0x7fc9e99f0640>) has no segue with identifier 'HomeToSettings''

The segue definitely exists and is connected, and there are many other segues on the same origin ViewController that work fine.

In the source code for the storyboard, the segue shows up just like all the working ones:

<connections>
<outlet property="notificationsButton" destination="hG9-8E-sv6" id="mn0-1x-Qxj"/>
<outlet property="settingsButton" destination="Fy0-au-d6J" id="r1c-fG-KOP"/>
<outlet property="tableView" destination="9bJ-Cd-hc3" id="Wuy-hJ-QVU"/>
<segue destination="ad8-yH-D5h" kind="show" identifier="HomeToCreateList" id="bsg-J2-Gp3"/>
//More segues... 
<segue destination="pNX-Jw-wau" kind="show" identifier="HomeToNotifications" id="B2t-BE-YpW"/>
<segue destination="xge-ah-WXM" kind="show" identifier="HomeToSettings" id="nTa-qO-SCb"/>
</connections>

I have tried:

  • Renaming the storyboard
  • Deleting and recreating the segue
  • Renaming the segue
  • Cleaning the project
  • Reinstalling the app
  • Reset content and settings on the simulator
  • Physical device

Xcode and iOS are up to date as of June 1, 2016.

If it's somehow important, I am triggering the segue through an IBAction attached to a UIBarButtonItem. However, another segue to a different ViewController from another UIBarButtonItem works perfectly.

The exact line with which I'm calling the segue is:

[self performSegueWithIdentifier:@"HomeToSettings" sender:self];

I'm really lost here.

1
Have you checked if the segue is available in the size class you are testing?dasdom
Go in interface builder. At the bottom there is something saying "Any : Any" or so. Change to the size class you are testing and see if the segue is still there. By the way: Interface Builder is bad for several reasons. You should create the UI in code.dasdom
The segue is there for all size classes.Hersh Bhargava
I would do that in code. There are less bugs than in storyboards and Interface Builder.dasdom
There is a huge number of views and segues in this storyboard. I'd like to get this working through there, though if there is a quick code-based fix for just this segue, I'm all ears.Hersh Bhargava

1 Answers

1
votes

For example you have show segue named HomeToSettings from VC-A to VC-B then you only can call [self performSegueWithIdentifier:@"HomeToSettings" sender:self]; only from VC-A.

If you tried to call from other controller then it will give error.

I just copied your statement [self performSegueWithIdentifier:@"HomeToSettings" sender:self]; and I found one weird character before H of your HomeToSettings string.

You can check it by left arrow key of keyboard or back space!!

Character looks like

enter image description here

So,remove it from everywhere where you set this identifier.

Copy identifier from below statement and use it to set in interface builder and use below statement to perform segue.

  [self performSegueWithIdentifier:@"HomeToSettings" sender:self];

Hope this will help :)