IOS问题 Application windows are ex

2018-11-12  本文已影响0人  六花垂冰丸

该错误提示缺少rootViewController
解决方法:在AppDelegate中添加一个rootViewController
代码:
在AppDElegate中的didFinishLauchingWithOptions方法中添加:

    NSArray *windows = [[UIApplication sharedApplication]windows];
    for(UIWindow *window in windows){
        if (window.rootViewController == nil) {
            UIViewController *vc = [[UIViewController alloc]initWithNibName:nil
                                                                     bundle:nil];
            window.rootViewController = vc;
        }
    }
上一篇下一篇

猜你喜欢

热点阅读