I've read that the tab bar controller of a project should always be the base controller, but I'm wondering, how do I present my sign in view controller if user is not logged in, then dismiss after user is logged in?
The following is my code
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let loginViewController = storyboard.instantiateViewControllerWithIdentifier("signInViewController") as! SignInViewController
self.window?.makeKeyAndVisible()
self.window!.rootViewController!.presentViewController(loginViewController, animated: true, completion: nil)
return true
}
It does work as expected but I'm having this shown in my console.
2016-01-07 12:37:58.139 Fingers[461:67210] Presenting view controllers on detached view controllers is discouraged <AppName.HomeViewController: 0x13ed4f8f0>.
2016-01-07 12:37:58.149 Fingers[461:67210] Unbalanced calls to begin/end appearance transitions for <UITabBarController: 0x13ed4ed60>.
Also this will trigger the view did load on the root view controller, is there any way to avoid that?