Link to home
Start Free TrialLog in
Avatar of Curtis Long
Curtis LongFlag for United States of America

asked on

Segue not being performed iOS

I've got an iOS app that allows a user to connect to our server and perform a couple tasks. It works great until I decided to throw an error in and make it go back to the previous view controller. I created a segue with the Identifier of "segShowError" that is supposed to be executed and send the user back to the parent screen. Currently the segue is a Modal, as is the one that goes from the first controller to the second one. The odd part is I was experiencing this same difficulty earlier when I was using a push segue and I fixed it by using a Modal instead. Here is the code that "should" be performing the segue.

NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
if(error != nil)
{
    NSLog(@"Error was %@",error);
    return;
}
else if([data length] <= 0)
{
    NSLog(@"No data received, going back");
    [self performSegueWithIdentifier:@"segShowError" sender:self];
}

Open in new window


And then I have a prepareForSegue method, it will determine what error message to send back to the parent, but right now just logs a message.

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    NSLog(@"Preparing for segue");
}

Open in new window


My output

2012-03-21 13:14:39.148 SSPColorImprov[17401:f803] No data received, going back

2012-03-21 13:14:39.149 SSPColorImprov[17401:f803] Preparing for segue

Open in new window


I would think that those two messages would indicate that the segue is being performed, but I could be wrong.

There are no errors logged, no warnings in the project, and no exceptions thrown. Any ideas what might be causing the problem?
ASKER CERTIFIED SOLUTION
Avatar of Curtis Long
Curtis Long
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial