Ios 无法强制转换类型为';UIViewController';
我正试图在我的项目中实现BWWalkthrough。然而,我得到一个错误声明Ios 无法强制转换类型为';UIViewController';,ios,swift,casting,lldb,bwwalkthrough,Ios,Swift,Casting,Lldb,Bwwalkthrough,我正试图在我的项目中实现BWWalkthrough。然而,我得到一个错误声明 Unknown class _TtC20BWWalkthroughExample27BWWalkthroughViewController in Interface Builder file. Could not cast value of type 'UIViewController' (0x195bca580) to 'AppName.BWWalkthroughViewController' (0x10042c3a
Unknown class _TtC20BWWalkthroughExample27BWWalkthroughViewController in Interface Builder file.
Could not cast value of type 'UIViewController' (0x195bca580) to 'AppName.BWWalkthroughViewController' (0x10042c3a0).
(lldb)
它指向下面的代码
let walkthrough = stb.instantiateViewControllerWithIdentifier("walk") as! BWWalkthroughViewController
我不知道为什么会这样。任何帮助都将不胜感激
您也可以向我的项目索取更多的代码。您的故事板似乎没有链接到
bwalkthroughviewcontroller
。查找视图控制器应位于的位置,然后检查它是否是视图控制器。请按照以下步骤解决问题
在IB中,确保将主视图控制器的类设置为BWWalkthroughViewController,以及模块BWWalkthrough。看。我自己也遇到了这个问题,有时候很容易忘记。我也有同样的问题 我可以在我的WalthThrough故事板中设置BWWalkthroughViewController,而不是BWWalkthroughPageViewController 我也有类似的问题 接口生成器文件中未知的类WelcomeViewController。无法将“UIViewController”(0x7fff898d1f50)类型的值强制转换为“SimpleLoginApp.WelcomeViewController”(0x108864c48) 可以通过以下步骤解决此问题:
您是否在Interface Builder中将自定义视图控制器的类显式设置为
bwalkthrowhviewcontroller
?Swift还不支持名称管理,因此您得到:\u ttc20bwalkthrowhexample27bwalkthrowhviewcontroller
,这类似于C++名称Mangle,但这是几十年前针对错误消息所做的。对于更多的信息,这些名称看起来像是<代码>