“Could not find any information for class named Vi

2019-01-12 22:57发布

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 find any information for class named ViewController.

This happens with custom classes as well. I've tried methods such as:

  • Deleting the delegate data.
  • Removing and re-adding the classes.
  • Restarting Xcode.
  • Reinstalling Xcode.

I can't ctrl-drag to create connections in any of my projects no matter what the class is. The same problem happens with a brand-new template application. If I type in the code manually and then ctrl-drag, I can make a working connection, but I can't add it automatically. Nothing I've been able to find so far on the Internet has helped. Any pointers?

30条回答
放荡不羁爱自由
2楼-- · 2019-01-12 23:38

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

查看更多
Explosion°爆炸
3楼-- · 2019-01-12 23:39

Sometime Xcode does due to VC not referencing class file. The simple solution for this is:

write property manually as given.

class YourClassName{

     @IBOutlet weak var YourTableName: UITableView!

}

This will make a empty link sign before @IBOutlet, open your project in assistant editor then click link sign enter image description here and drag into the View which you want to connect (i have connected with TableView). and thats it. Enjoy Happy Coding!!!

查看更多
劳资没心,怎么记你
4楼-- · 2019-01-12 23:40

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

查看更多
Animai°情兽
5楼-- · 2019-01-12 23:40

Delete the files (only the references) and add the files again.

查看更多
对你真心纯属浪费
6楼-- · 2019-01-12 23:43

I tried everything and it didn't work, so for me what worked is:

  • Clean Build folder and project.
  • Open Projects (Window -> Projects)
  • Find your project on the list and delete the Derived Data
  • Close Xcode
  • Restart computer (without choosing to reopen windows that are open)
  • run Xcode
  • Work!

All my view controllers were not being recognized, so deleting all files and re-adding was not an option as this is a big project.

查看更多
倾城 Initia
7楼-- · 2019-01-12 23:44

This is the EASIEST step that I did to fix this problem.

  1. I clean the project
  2. Drag a new button in the view controller.
  3. Build the project.
  4. Connect the newly dragged the button to the class (either outlet or action).
  5. Then voila!!! Other outlets can now be connected to the class again!
查看更多
登录 后发表回答