呈现模态视图控制器时收到错误。它说我的视图控制器已分离。任何解决方案?

I received an error when presenting a modal view controller. It says my view controller is detached. Any solution?

错误:"Presenting view controllers on detached view controllers is discouraged ."

HomeView *objHomeView = [[HomeView alloc] initWithNibName:@"HomeView" bundle:nil];
objNav = [[UINavigationController alloc] initWithRootViewController:objHomeView];

[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
NSArray *controllers = [NSArray arrayWithObject:objHomeView];
self.sideMenu.navigationController.viewControllers = controllers;
self.window.rootViewController = [self sideMenu].navigationController;
[window makeKeyAndVisible];

改变

NSArray *controllers = [NSArray arrayWithObject:objHomeView];

NSArray *controllers = [NSArray arrayWithObject:objNav];