Rouge1 Rouge1 - 1 month ago 5
Swift Question

Cannot push a view controler after sucessfull login

I am trying to send it to another view on successful login so i am just testing my logic at this stage

let viewController:UIViewController = self.storyboard?.instantiateViewControllerWithIdentifier("myMainView") as! mainController
self.presentViewController(viewController, animated: true, completion: nil)


I have given my tab bar controller the name of myMainView but again i am being presented with


Could not cast value of type 'UITabBarController' (0x1abc8c828) to 'apertureswift.mainController' (0x1000210a0).
2016-10-09 11:56:17.549751 apertureswift[544:55199] Could not cast value of type 'UITabBarController' (0x1abc8c828) to 'apertureswift.mainController' (0x1000210a0).

Answer

if you send to UITabbarController you should change mainConrtoller to UITabbarController and identifier . you must set identifier for UITabController

 let viewController:UIViewController = self.storyboard?.instantiateViewControllerWithIdentifier("tabcontroller") as! UITabbarController
  self.presentViewController(viewController, animated: true, completion: nil)
Comments