-1

Error : "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];
seggy
  • 1,176
  • 2
  • 18
  • 38

1 Answers1

1

Change

NSArray *controllers = [NSArray arrayWithObject:objHomeView];

To

NSArray *controllers = [NSArray arrayWithObject:objNav];
Pranay
  • 372
  • 1
  • 10
  • This error may occur when you are trying to present view controller before view actually did appear. You can check this thread for more info. http://stackoverflow.com/questions/19890761/warning-presenting-view-controllers-on-detached-view-controllers-is-discourage – Pranay Aug 29 '16 at 11:38