我得到這個錯誤「應用程序試圖在目標上呈現一個零模式視圖控制器。」 這是我有的代碼,我試圖設置,如果條件滿足,它會改變初始視圖控制器。爲什麼我會呈現無模式視圖控制器?
- (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;
}
清理你的項目一次並重建它,希望它解決你的問題 –