当前位置:   article > 正文

解决root view controller_main actor-isolated property 'rootviewcontroller'

main actor-isolated property 'rootviewcontroller' can not be mutated from a

搭建平台测试的时候

出现这样的问题Application windows are expected to have a root view controller at the end of application launch

解决方法:

1.将

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
}

改为

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    
    return YES;
}


也可以自己添加一个rootView

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Override point for customization after application launch.
    YcanMainViewController *mainViewController = [[YcanMainViewController alloc] init];
    UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:mainViewController];
    self.window.rootViewController = nav;
    self.window.backgroundColor = [UIColor whiteColor];
    [self.window makeKeyAndVisible];
    return YES;
}

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/227746
推荐阅读
相关标签
  

闽ICP备14008679号