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];
but the rootViewController isn't the one displayed at the moment? How should I implement generic function, that whenever user credentials check fails it can present a login view controller?
Are you using a navigation controller?
I would use a navigation controller and then you can get a reference to the displayed one like: displayedController = [navController topViewController]; Then you can push modally like above where you would replace self with displayedController.
I fixed this problem by taking out the present method of the viewDidLoad and put it in the viewDidAppear.
This solution is outdated: 'presentModalViewController:animated:' is deprecated: first deprecated in iOS 6.0.