I am having hard time getting performSegueWithIdentifier to work. I keep getting
"Receiver (<UINavigationController: 0x1e59a9d0>) has no segue with
identifier 'identA'"
What I did is that:
Step: wired View controller A to View controller B with push segue with Identifier "identA" Like this:
Step: added a call to performSegueWithIdentifier onView controller A's ViewDidLoad. Like this:
- (void)viewDidLoad
{
[super viewDidLoad];
[self.navigationController performSegueWithIdentifier:@"identA" sender:self];
// Do any additional setup after loading the view, typically from a nib.
}
What have I done wrong???
You are calling performSegueWithIdentifier:sender:
on self.navigationController
but you setup the segue on View controller A
:
wired View controller A to View controller B with push segue with Identifier "identA"
Try replacing:
[self.navigationController performSegueWithIdentifier:@"identA" sender:self];
with
[self performSegueWithIdentifier:@"identA" sender:self];
Just another suggestion (which saved me today)...
I've written many iPad & iPhone apps before, using Master-Detail pages, Navigation Controllers, etc, but today, I was stumped, as my simple two-screen iPhone app in XCode 5.1 refused to let me segue from one screen to another, within a UINavigationController.
It's another of those insane XCode bugs which made no sense. I could even create a new XCode project, and there, the same segue would work perfectly.
[self performSegueWithIdentifier:@"segueTest" sender:nil];
Eventually, I found out the cause.
I had created a blank project in XCode, manually added a Storyboard to my project, but, I'd missed a step.
When you add a Storyboard yourself, you also need to go into your .plist file, and manually add a line telling your app the name of your main storyboard.
If you don't do this, strangely, your app will build successfully, it will run, you'll probably get your first screen to be displayed successfully... but then things (like finding segue names) will start to go wrong.
(Sigh.)
I hope this helps other XCode victims.
I need a beer...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With