title: Programmatically call a segue cause NSInvalidArgumentException, reason: 'UILabel length' unrecognized selector
body: <p>I am trying to do a conditional segue. But I get:</p>
  
  <pre><code>    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UILabel length]: unrecognized selector sent to instance 0x763c8e0'
  </code></pre>
  
  <p>The design is, when I pressed a button, the app will retrieve some data from the internet using AFNetworking's AFJSONRequestOperation. If the request succeed, it will call another UIViewController from my current UIViewController. I did my conditional start segue using <a href="https://stackoverflow.com/questions/8581766/proper-way-to-do-conditional-segue-in-ios5">this method</a> and below are my codes:</p>
  
  <pre><code>-(void) login:(NSString*)pinString{    
  NSString* urlString = [NSString stringWithFormat:@"%@%@%@", [super.serverResource getURL], [super.serverResource getRequestByKey:@"login"] ,pinString];
  NSURL *url = [NSURL URLWithString:urlString];
  NSURLRequest *request = [NSURLRequest requestWithURL:url];    
  AFJSONRequestOperation *operation = [MenuletJSONRequestOperation JSONRequestOperationWithRequest:request success:^(NSURLRequest *request, NSHTTPURLResponse *response, id JSON) {
      [self performSegueWithIdentifier:@"login" sender:self];
  } failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON){
      switch([response statusCode]){
          case (403):{
              UIAlertView* alert = [[UIAlertView alloc] initWithTitle:@"Log in failed"
                                                        message:@"Log in denied, check your PIN."
                                                        delegate:nil cancelButtonTitle:@"OK"
                                                        otherButtonTitles:nil];
              [alert show];
              break;
          }
      }
  }];
  [operation start];
  </code></pre>
  
  <p>}</p>
  
  <pre><code>- (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
  UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
  SettingViewController *settingVC = (SettingViewController*)[storyboard instantiateViewControllerWithIdentifier:@"SettingViewController"];
  [self presentViewController:settingVC animated:YES completion:nil];
  </code></pre>
  
  <p>} </p>
  
  <p>And I get the exception above after "ViewDidLoad" excuted in SettingViewController. If I don't use conditional segue, and simply ctl drag from the Button to SettingViewController on IB, everything works fine... please give me some suggestion... I am really out of ideas...</p>
  
  <p>Below are my code from SettingViewController:</p>
  
  <pre><code>- (void)viewDidLoad{
  [super viewDidLoad];
  // Do any additional setup after loading the view.
  //StringResources* resource = [[StringResources alloc]init];
  [self.titleLabel setText:[super.stringResource getStringByKey:@"screen_setting_title"]];
  [self.createOrderLabel setText:[super.stringResource getStringByKey:@"screen_setting_create_order_label"]];
  [self.refreshMenuLabel setText:[super.stringResource getStringByKey:@"screen_setting_refresh_menu_label"]];
  [self.tableNumberLabel setText:[super.stringResource getStringByKey:@"screen_setting_table_number_label"]];
  </code></pre>
  
  <p>}</p>
  
  <p>Actually, I didn't put much thing in SettingViewController, all I did was programatically setting some label. And I put breakpoint on each setText, and they all executed without error. So the exception must happened after ViewDidLoad...</p>
  
  <p>This is where the error occur:</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  #import "AppDelegate.h"
  int main(int argc, char *argv[])
  {
      @autoreleasepool {
          return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); //error occur here
      }
  }
  </code></pre>
  
  <p>Solved... Turn out Segue handle everything. All I need to do is setup a generic segue. and once I called [self performSegueWithIdentifier:@"login" sender:self], everything works perfectly. Thank you everyone... (overriding prepareForSegue will only cause a problem...)</p>