Solved

Segue not being performed iOS

Posted on 2012-03-21
1
1,042 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What's a UDID? If you're involved in developing, testing, or even reviewing an iOS application that's in beta, then at some point you may need to know the UDID for any iOS devices that you'll be testing on. What's the UDID? It stands for Unique Dev…
There is a security feature on iOS devices that is nearly impenetrable when it has been activated.  This article will provide some possible solutions as well as necessary steps to take to ensure you do not end up with a locked device.
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.
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

914 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

19 Experts available now in Live!

Get 1:1 Help Now