Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not cast value of type 'UIViewController'

I am trying to implement BWWalkthrough in my project. However I get an error stating

Unknown class _TtC20BWWalkthroughExample27BWWalkthroughViewController in Interface Builder file.
Could not cast value of type 'UIViewController' (0x195bca580) to 'AppName.BWWalkthroughViewController' (0x10042c3a0).
(lldb) 

It is pointing at the below code

let walkthrough = stb.instantiateViewControllerWithIdentifier("walk") as! BWWalkthroughViewController

I don't know why this is happening. Any help would be appreciated.

Also feel free to ask for more code from my project.

like image 282
Satsuki Avatar asked Aug 16 '15 18:08

Satsuki


3 Answers

Your storyboard doesn't seem to be linked to a BWWalkthroughViewController. Find where the view controller should be a BWWalkthroughViewController, and check if it is one.

like image 86
saagarjha Avatar answered Nov 14 '22 00:11

saagarjha


I have same issue.

I can fix to set BWWalkthroughViewController, not BWWalkthroughPageViewController in my walthrough storyboard.

enter image description here

like image 5
nobuhiroharada Avatar answered Nov 14 '22 01:11

nobuhiroharada


I had a similar issue

Unknown class WelcomeViewController in Interface Builder file. Could not cast value of type 'UIViewController' (0x7fff898d1f50) to 'SimpleLoginApp.WelcomeViewController' (0x108864c48).

Was able to resolve it by following these steps:

  1. Open storyboard file
  2. Select the View Controller that is not being identified.
  3. Open Attribute Inspector and check if the "Module" text field is mapped with the appropriate app name.

enter image description here

like image 3
GeekyDeveloper Avatar answered Nov 14 '22 00:11

GeekyDeveloper