特定の設定がされている場合、アプリのログイン ビューをスキップしようとしていますNSUserDefault
。この投稿を見つけましたが、以下に概説する問題がまだあります。
ストーリーボードに新しいビューを追加し、開始時にロードされるビューに設定しました。また、特定のセグエが設定されていない場合に起動するセグエも設定しましたNSUserDefault
。
次のエラーが表示されます。
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.
}