Q&A: How do I fix the "Could not insert new outlet connection" error?
Whenever you see the dreaded "Could not insert new outlet connection. Could not find any information for the class named xx", it's almost always an Xcode problem. Even though the class named in the error message is in your project, Xcode loses track of it, and acts as if it's not there.
Assuming you have already tried restarting Xcode to fix the problem (you should try this first), here are a few solutions to this problem:
Remove the Class Files and Add Them Back in Again
- In the Project Navigator, select the .h and .m files of the class that Xcode is complaining about in the message.
- Press the delete key.
- When the confirmation dialog appears, choose the Remove References option.
- In the Project Navigator, right-click your project's main group and select Add Files to xx from the popup menu.
- Add the .h and .m class files back into the project.
Force Xcode to Rebuild the Project's Index
Xcode builds an index of all the files contained in the project. If this index has become corrupt, you can force Xcode to rebuild the index by following these steps:
- Open Xcode, but make sure the project is closed
- Click the Organizer button on the right side of the toolbar at the top of the Xcode window.
- In the Organizer window, click the Projects tab.
- On the left side of the Organizer window, select the project that has the problem.
- On the right side of the Organizer window, click the Delete button next to the Derived Data path.
- Reopen the project.
Hopefully one of these solutions works for you!
Author: iOS App Development for Non-Programmers book series