我收到此错误“应用程序试图在目标上呈现一个零模式视图控制器。” 这是我拥有的代码,如果满足条件,我正在尝试设置,它将更改初始视图控制器。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( NSDictionary *)launchOptions
{
if(![[NSUserDefaults standardUserDefaults] boolForKey:@"logged_in"]) {
ViewControllerOne *vc1 = [[ViewControllerOne alloc]init];
vc1=[self.storyboard instantiateViewControllerWithIdentifier: @"vc1"];
[self presentViewController:vc1 animated:YES completion:Nil];
} else {
ViewControllerTwo *vc2 = [[ViewControllerTwo alloc]init];
vc2=[self.storyboard instantiateViewControllerWithIdentifier: @"vc2"];
[self presentViewController:vc2 animated:YES completion:Nil];
}
// Override point for customization after application launch.
return YES;
}