Attempt to present * on * whose view is not in the window hierarchy

You can’t display a modal view controller from the appDelegate. You need to display a modal ViewController from whichever viewController is currently displaying full-screen. In other words, you need to put that code into your root view controller, or whichever one you want to display the modal vc from…

Also, you’ll want to use the method “presentModalViewController” to present the modal. You can set properties on the modal vc such as:

vC.modalPresentationStyle = UIModalPresentationFormSheet;
vC.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentModalViewController:vC animated:YES];

Leave a Comment