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


  1. In the Project Navigator, select the .h and .m files of the class that Xcode is complaining about in the message.
  2. Press the delete key.
  3. When the confirmation dialog appears, choose the Remove References option.
  4. In the Project Navigator, right-click your project’s main group and select Add Files to xx from the popup menu.
  5. 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:


  1. Open Xcode, but make sure the project is closed
  2. Click the Organizer button on the right side of the toolbar at the top of the Xcode window.
  3. In the Organizer window, click the Projects tab.
  4. On the left side of the Organizer window, select the project that has the problem.
  5. On the right side of the Organizer window, click the Delete button next to the Derived Data path.
  6. Reopen the project.

Hopefully one of these solutions works for you!


 


Kevin McNeish 



Author: iOS App Development for Non-Programmers book series 
Twitter: @kjmcneish


 


 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>