Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 设置rootViewController时向VC发送无法识别的选择器'InhibitationRotationAnimation'_Ios_Swift_Cocoa Touch_Uiapplication - Fatal编程技术网

Ios 设置rootViewController时向VC发送无法识别的选择器'InhibitationRotationAnimation'

Ios 设置rootViewController时向VC发送无法识别的选择器'InhibitationRotationAnimation',ios,swift,cocoa-touch,uiapplication,Ios,Swift,Cocoa Touch,Uiapplication,启动应用程序后,BaseVC初始化。在BaseVC中,我将验证用户是否已登录。如果为true,我的应用程序将使用以下命令跳转到主选项卡栏控制器: UIApplication.sharedApplication().windows.last?.rootViewController = tabbarController UIApplication.sharedApplication().windows.last?.rootViewController = navi 如果没有,我的应用程序将使用以

启动应用程序后,BaseVC初始化。在BaseVC中,我将验证用户是否已登录。如果为true,我的应用程序将使用以下命令跳转到主选项卡栏控制器:

UIApplication.sharedApplication().windows.last?.rootViewController = tabbarController
UIApplication.sharedApplication().windows.last?.rootViewController = navi
如果没有,我的应用程序将使用以下命令跳转到登录导航控制器:

UIApplication.sharedApplication().windows.last?.rootViewController = tabbarController
UIApplication.sharedApplication().windows.last?.rootViewController = navi
上面的代码按照我的要求正确运行。但在登录导航控制器中,在用户输入正确的用户名和密码后,我希望应用程序使用与上面相同的代码跳转到主tabbar控制器:

UIApplication.sharedApplication().windows.last?.rootViewController = mainController
但我总是会被错误迷住:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[Myapp.MyappMainTabbarVC inhibitRotationAnimation]: 
unrecognized selector sent to instance 0x7ff15b205ec0'

为什么?

您确定第一次和第二次传递的是同一个对象吗?首先要传递
tabbarController
,然后要传递
mainController
到窗口的
rootViewController
属性。@BellAppLab对于名称的误导表示抱歉。我确信这两个名字是同一个物体。