I am working on an ios app and I am new to this. So, I get this error. What I'm trying to do is when the user first logs into the application, his username is stored locally on the phone using NSUserdefault.
Now, if they close the application and open it again, the application goes through the first view controller and in the viewdidload method checks if the USUserdefault is longer than zero, and if so, go to the main action by making a segue call, However, I get this error when I run it.
This is what I did on my storyboard. 
This is the code in the first controller
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; NSString *user = [prefs stringForKey:@"userName"]; if(user.length>0){ NSLog(@"Going straight to main %s", "Yes"); [self performSegueWithIdentifier:@"startMain" sender:self]; } }
source share