31
votes

I have been trying everything for hours, and nothing's worked. I am trying to segue between two view controllers, from one tableViewController to another tableViewController. The segue is hooked up to the top level view, not the tableviewcell. The identifier that was set in Xcode is identical to the one used in the code (copy and pasted). It was working fine last night, but now i can't seem to get it to segue without crashing.

here are the methods in which the segue is called

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

    self.photoList = [FlickrFetcher photosInPlace:[self.topPlacesList objectAtIndex:indexPath.row] maxResults:50];
    NSLog(@"photolist %@", self.photoList);

    NSLog(@"here");

    [self performSegueWithIdentifier:@"segue1" sender:self];
    NSLog(@"here");
}


-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if([segue.identifier isEqualToString:@"segue1"])
    {
        PhotosTableViewController *photosTVC = segue.destinationViewController;
        photosTVC.photoList = self.photoList;
    }
}

here is the error report

2012-08-08 15:28:39.093 Top Places[512:f803] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Receiver (PlacesTableViewController: 0x6887ff0) has no segue with identifier 'segue1'' * First throw call stack: (0x13c0052 0x1551d0a 0xde24b 0x3efd 0xa771d 0xa7952 0x92f86d 0x1394966 0x1394407 0x12f77c0 0x12f6db4 0x12f6ccb 0x12a9879 0x12a993e 0x17a9b 0x2778 0x26d5) terminate called throwing an exception

here is a screenshot of the storyboard http://s14.postimage.org/66wf13q4h/Screen_Shot_2012_08_08_at_3_22_10_PM.png

8
Hey! i fixed it! 1. make sure the right storyboard is selected in Xcode(if you rename the storyboard change it in the project summary). then delete the app on the simulator and restartJames Traimory
Deleting app is a solution! Tnx!k06a
In some cases, the delete alone won't work. You will need to clean and build the application again.bizsytes
Also: Check if you localized your storyboard or messed around. I had two versions (one in en.lproj/ and the other in es.lproj/) and the one being used (en) wasn't the same I was modifying (es). I just removed from project, deleted the unused one and added back the "good" one.Ramon Poca
Wow, what a bug! I too removed the app from the simulator after changing the location of a segue and it works now.ThaDon

8 Answers

50
votes

I was able to fix it by running "clean" under the "Product" menu in Xcode, and resetting the contents and settings in the simulator.

6
votes

I had this same problem. In my initializer - (id)initWithCoder:(NSCoder *)aDecoder I was doing self = [super init]; when I should have done self = [super initWithCoder:aDecoder];. When I fixed this everything worked as expected.

4
votes

I had the same problem and struggled with it for hours. Stackmonster's answer solved my problem (rename the storyboard), but I didn't understand why it solved the problem.

I found that when I changed an item on the storyboard (added a label or changed background colour) it was not reflected in the simulator - I wasn't using the storyboard that I could see in xcode, but an older version of the storyboard. I had to rename the storyboard in the project navigator and also rename it in the info.plist (in supporting files) and my label appeared, and the background colour applied, and the segue worked.

I don't know why the storyboard changes weren't taking effect, but it caused me a huge amount of time to find. I've seen on the blogs that a lot of devs have the same problem.

3
votes

i fixed it! 1. make sure the right storyboard is selected in Xcode(if you rename the storyboard change it in the project summary). then delete the app on the simulator and restart

0
votes

In Interface Builder you need to set the segue identifier to segue1 which is a segue connected to your view controller.

0
votes

I tried everything listed and had no luck. What worked was to create a new segue to a new View, then use that one, run it, then create a segue back to the old view.

0
votes

Had this problem with an unwind segue. Finally realized that I lost my identifier when I replaced a view controller on the storyboard. I re-added it by clicking on the unwind segue in the document outline (sidebar of storyboard), and then in the attributes inspector, add the identifier for it.

If nothing else works, at lease in regards to unwind segues, you can call

[self dismissViewControllerAnimated:YES completion:nil];
0
votes

I had the same problem as I made new VC as subclass of another view controller. It should be subclass of UIViewController or UITableViewController. Check header file whether UIKIT is being imported or not.