IOS 5 Segue not working after first run

I am creating an iOS5 application using the storyboard features. The basic structure:

LoginScreen --- (segue) → MyScreen --- (click on exit) ------ (go to the login screen) → LoginScreen

It is pretty simple. First session management method:

- (void) onResponse:(NSMutableDictionary *)response {
  NSLog(@"Login successful,token received");
  // if the Login was successful,store the token 
  NSUserDefaults* userPref = [NSUserDefaults standardUserDefaults];    
  [userPref setObject:[response objectForKey:@"Token"] forKey:@"AuthToken"];
  [userPref synchronize];
  //..and let the user getting in
  [self performSegueWithIdentifier:@"showHomeScreen" sender:nil];
}

Now it’s strange that segue runs correctly for the first time, but when I return to the login screen after logging out, performSegueWithIdentifier: no longer works (no message error, nothing just happens). Not sure what is going on. What could be the problem?

I am attaching a screenshot of the storyboard. You can see the loop in the upper right corner: enter image description here

Many thanks!

Klaus

+2
source share
1

, LoginVC Segue.

ViewController. VC - LoginVC. , , VC . LoginVC Segues, VC. , , .

: LoginViewController.h:

@protocol LoginViewControllerDelegate
    -(void)finishedLoadingUserInfo;
@end

@interface LoginViewController : UIViewController <UITextFieldDelegate>{
    id <LoginViewControllerDelegate> delegate;
}

LoginViewController.m:

@synthesize delegate;

- (void) onResponse:(NSMutableDictionary *)response {
  NSLog(@"Login successful,token received");
  // if the Login was successful,store the token 
  NSUserDefaults* userPref = [NSUserDefaults standardUserDefaults];    
  [userPref setObject:[response objectForKey:@"Token"] forKey:@"AuthToken"];
  [userPref synchronize];
  //..and let the user getting in
  [delegate finishedLoadingUserInfo];
}

DSC- VC.m:

#pragma mark - LoginViewController Delegate Method
-(void)finishedLoadingUserInfo
{    
    // Dismiss the LoginViewController that we instantiated earlier
    [self dismissModalViewControllerAnimated:YES];

    // Do other stuff as needed
}

, , , , ( VC ):

[self performSegueWithIdentifier:@"sLogin" sender:nil];

prepareForSegue ( Dashboard VC):

-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.identifier isEqualToString:@"sLogin"]) {
        LoginViewController *livc = segue.destinationViewController;
        livc.delegate = self; // For the delegate method
    }
}

Segue sLogin, :)

Storyboard

+4

All Articles