7

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.

Sphinxxx
  • 12,484
  • 4
  • 54
  • 84
Satsuki
  • 2,166
  • 5
  • 17
  • 33
  • 1
    did you set the class of the custom view controller explicitly to `BWWalkthroughViewController` in Interface Builder? – vadian Aug 16 '15 at 18:20
  • 1
    Swift does not support name de-mangiing yet so you get: `_TtC20BWWalkthroughExample27BWWalkthroughViewController`, this is similar to C++ name mangling but that was addressed for error messages decades ago. – zaph Aug 16 '15 at 18:37
  • For more info on the names that look like `_TtC20BWWalkthroughExample27BWWalkthroughViewController`, see https://stackoverflow.com/questions/24062957/swift-objective-c-runtime-class-naming – auspicious99 Jun 20 '20 at 12:14

5 Answers5

6

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.

saagarjha
  • 2,221
  • 1
  • 20
  • 37
6

I have same issue.

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

enter image description here

nobuhiroharada
  • 499
  • 4
  • 13
3

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

GeekyDeveloper
  • 141
  • 1
  • 6
0

In the IB make sure that you set the class of the master view controller into BWWalkthroughViewController, as well as the module BWWalkthrough. See the image . I just ran into this problem myself, easy step to forget sometimes.

Gregortega
  • 16
  • 2
-1

Please follow these steps to fix your issues.

  1. Create BWWalkthroughViewController ViewController Class.
  2. Main StoryBoard
  3. BWWalkthroughViewController
  4. Show Identity Inspector.
  5. Add BWWalkthroughViewController
  6. Check again
Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92