I got the same problem as you today... I think this is a bug of Xcode, below is the way to fix the issue:
- Close the project you are working on with.
- Delete your project's【DerivedData】folder. (This folder may inside your project's folder, or inside ~/Library/Developer/Xcode/DerivedData/(your project)/ ) or somewhere else that was setup by you.
- restart your project.
After these steps, the problem should be solved. And from my experience, these steps can solve many Xcode problems, so if you got some problem with Xcode again, try these steps first.
Removing(removing reference, not deleting) and then adding the appropriate file(the file of class you want to add the outlet to) is actually enough.
Edit 1 I found that after unchecking (in XCode 6.3.1) I had to wait a few seconds for the Indexing
to appear and complete in the project name box. Same for the way backwards. This increased chances to fix the issue in almost all (but not all) cases.
Edit 2 Removing reference means that You do not delete the file completely but just remove it from the project (it still exist in the folder of your project, you add it later).
That's most often a problem of file indexing
.
To fix it try to clean your target
and if this doesn't work, go to your Derived Data
folder and delete your application there.
This will force xCode to reindex the files
Just got the same issue on Xcode 4.6.2.
Tried solutions presented in different answers/comments, but it still didn't work.
Then all I did was to just:
Hope this will save some time/frustration for somebody else.
Personally, I had the same problem: "could not insert new outlet connection" AND when I was starting typing something like "UI..." XCode wasn't doing anything. I searched for answers, I tried several things... but it was just an unchecked box. When I was creating a new class, XCode unchecked the box linking the class to the project (I guess).
I can't post a screen shot because I don't have 10 reputations but when you create your class, XCode asks you where you want to save it. Down the finder window, you have 'Targets' and two boxes: 'YouProjectName' and 'YouProjectNameTests'. You should check the first one (at least).
Hope this will help. I saw different discussions about the subject.
I recently came across this problem. I soon realized that the cause had been my own doing. I had previously disabled XCode indexing (which used to take forever & eat up my RAM), using the below code in a terminal window:
defaults write com.apple.dt.XCode IDEIndexDisable 1
To revert XCode to its default state, i used the following line in a terminal window:
defaults write com.apple.dt.XCode IDEIndexDisable 0
Voila! All's well again..
If you've imported the Class into your Xcode Project you have to manually add the Class (.m file) to your 'Compile Sources'.
Select project icon > TARGETS > Build Phases > Compile Sources Click the + button and add your *.m file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With