如果设置了特定的NSUserDefault
,我会尝试跳过我的应用的登录视图。我找到了这个post,但我仍然有下面列出的问题:
我在故事板上添加了一个新视图,并将其设置为开始时加载的视图。如果未设置特定的NSUserDefault
,我还会设置一个segue。
我收到以下错误:
Warning: Attempt to present <QMALogInViewController: 0x8838cf0> on <DefaultLoginCheckViewController: 0x7557400> whose view is not in the window hierarchy!
在开始时加载的视图:
- (void)viewDidLoad
{
NSString *accountID = [[NSUserDefaults standardUserDefaults] stringForKey:@"CurrentUserId"];
if (![accountID length]) {
NSLog(@"I should be heading to the log in form");
[self performSegueWithIdentifier:@"notloggedin" sender:self];
} else{
NSLog(@"Heading over to CRNA menu");
[self performSegueWithIdentifier:@"crnaloggedin" sender:self];
}
NSLog(@"I should be heading to the log in form");
[super viewDidLoad];
// Do any additional setup after loading the view.
}