Solved

Segue not being performed iOS

Posted on 2012-03-21
1
1,041 Views
Last Modified: 2012-06-21
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?
0
Comment
Question by:HDM
1 Comment
 

Accepted Solution

by:
HDM earned 0 total points
ID: 37753528
I used dismissViewControllerAnimated rather than using a segue to get back to the parent view, which works great.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

     Intro      In this article, I will show you how to parse a JSON in Swift using an open source library called SwiftyJSON (https://github.com/SwiftyJSON/SwiftyJSON). If you haven't heard of a JSON before, it stands for JavaScript Object Notation…
The release of the iPhone 6 and the iPhone 6 Plus was extremely successful for Apple. However when iOS 8.1 was introduced, many iPhone users complained of quick battery drainage. Without even knowing, you may be unnecessarily using up your battery p…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now