0

如果设置了特定内容,我正在尝试跳过我的应用程序的登录视图NSUserDefault。我找到了这篇文章,但我仍然遇到以下问题:

我在情节提要中添加了一个新视图,并将其设置为开始时加载的视图。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.
}
4

0 回答 0