“Could not find any information for class named ViewController”

后端 未结 30 1818
南方客
南方客 2020-12-02 06:35

This bug has been driving me nuts since I started using Xcode (4.6.3). Whenever I try to link a Storyboard item to my code, I get the error:

Could not

相关标签:
30条回答
  • 2020-12-02 07:28

    Product > Clean (Command - Shift - K) fixed it for me!

    0 讨论(0)
  • 2020-12-02 07:32

    Just need to clean and re-build the project.

    0 讨论(0)
  • 2020-12-02 07:32

    I tried EVERYTHING!

    Make sure the class name of your UIViewController does not contain the word "Test"

    Bug Report submitted.

    0 讨论(0)
  • 2020-12-02 07:33

    What solved this issue for me was actually deleting the class from the project.

    Steps:

    1. In the project file explorer (left panel) find the class and right click -> Delete
    2. Remove reference (do not move to trash as you will lose the class for good)
    3. Right click on the folder that contained the class -> Add files to ...
    4. Find the class you just deleted in the file system

    This seems to force Xcode to link the class back into the storyboard.

    Note: for me the following did not work:

    • Closing Xcode
    • Cleaning the project
    • Deleting the class name from the storyboard and re-entering it

    I think this is a bug on Apple's part

    0 讨论(0)
  • 2020-12-02 07:33

    In case anyone is still frustrated by this, there's a trick to get things working.

    What I do is manually enter an outlet into my class, for example: @IBOutlet weak var someView: UIView!, and drag from the code to the view in IB or storyboard. After this, I am able to drag from IB / Storyboard to my class to make connections, assistant editors recognizes the class in "Automatic", etc...

    Works every time.

    0 讨论(0)
  • 2020-12-02 07:33

    If people try the above and things are still not working, the strange trick that worked for me was adding the outlet in a chunk of whitespace. It works if there are no other lines directly above or below the line you're adding. Strange, but it worked!

    0 讨论(0)
提交回复
热议问题