Could not insert new outlet connection [duplicate]
Asked Answered
A

9

158

Could not insert new outlet connection: Could not find any information for the class and not showing any class named "ViewController"

Solutions I have done : - Restarted XCode - Restarted System - Deleted the Deriveddata contents from /Library/developer/xcode

But nothing worked for me

Here is the screenshot for the error enter image description here

Amalee answered 8/3, 2013 at 7:22 Comment(4)
just refer the following link #10996523 this may helpRoper
Sorry trojanfoe and sugan.s, I already went through those link.Amalee
I restarted XCode(7.2). it works for me.Tena
I just used "clean" in the "product" menu and it fixed it for me.Loughlin
G
259

I got the same problem as you today... I think this is a bug of Xcode, below is the way to fix the issue:

  1. Close the project you are working on with.
  2. 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.
  3. 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.

Geometrize answered 24/4, 2013 at 3:5 Comment(0)
A
134

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).

enter image description here

Antrim answered 12/4, 2013 at 13:17 Comment(9)
what is appropriate file here?Amalee
see edited answer, I meant the .h and .m files of broken classAntrim
thanks, didn't need to check copy items if needed by the way when adding file backSpurlock
I had to delete the whole cell and restart Xcode and recreate the files. It looks like this part of Xcode is a bit flakey :)Hards
Worked on Xcode 7 beta 3.Acidulant
This actually worked and it's the simplest one.Kronick
how do you "remove the reference" exactly?Yuen
This is the easy way. Thanks.Manipur
Your comment was a life saver! Thank you so much! I kept reading comments all over google and every one said to clean and remove reference but I didn't understand what they meant. From your detailed comment and images I was able to successfully delete the reference of my view controller and add it back. Everything worked!Fossil
G
51

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 Datafolder and delete your application there. This will force xCode to reindex the files

Goldin answered 8/3, 2013 at 7:35 Comment(6)
Sorry Alexander, I've tried that also, even I've I removed the xcode competely from my mac and reinstall the xcode but still issue is there. I can type the whole line like "@property (strong, nonatomic) IBOutlet UIImageView *myImage;" in .h, then hook the nib component to this line. But drag and drop is not working and auto detection of classes instances in .m file are also not workingAmalee
is your File's Owner Connected to your view Controller? You can look up in the right bar's "Identity Inspector". The custom class should be your custom UIViewController subclassGoldin
Yes. I can run the project. If File's Owner is not connected, the app will crash.Amalee
So I'm sorry, I have no other idea how to solve this. In my experience I just had to delete the derived data folder via Organzier > Projects > Delete Derived DataGoldin
@Goldin +1 It works. thanks. Just need to relaunch the xcode after this.Leicestershire
I had another window of Xcode opened up for another project and the simulator was also running. I just closed both of them and Product-> Clean my current application. It works.Conney
K
13

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:

  1. save all my work;
  2. just quit Xcode & load it again;
  3. then I was able to insert the new outlet connection successfully.

Hope this will save some time/frustration for somebody else.

Knesset answered 25/5, 2013 at 2:23 Comment(2)
Simply rebooting worked for me as well, Xcode 5.0.2.Tanbark
This worked for me as well Xcode 8.2Massotherapy
H
12

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.

screenshot when creating your new class

Hallee answered 23/7, 2013 at 10:37 Comment(1)
For *.m file of this class view open "Show File Inspector" and unchecking "Target membership" for this project, then do Clean (menu Product->Clean) and checking again "Target membership" for this projectAzimuth
M
7

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..

Muniment answered 2/8, 2013 at 6:58 Comment(3)
You are a genius! I spent hours trying all the other solutions and this is the only one that worked for me.Source
finally a solution, had this issue on and on with xcode7Restore
it's working for me. Xcode 9Misery
S
4

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.

Semiskilled answered 22/7, 2013 at 11:59 Comment(1)
It can't recognize my .m or .h class inside a folder. It just detect the default classes. Do you have any other solution?. :´Lipography
A
3

Finally I did it by removing the xcode completely from my mac and reinstall the xocde.dmg file and then install MobileDevice.pkg and MobileDeviceDevelopment.pkg residing on /Applications/Xcode.app/Contents/Resources/Packages

Amalee answered 8/3, 2013 at 13:28 Comment(2)
should have burned the house tooFrancefrancene
are you sure this the right solution :(Thresathresh
L
0

make sure that your source have had been included in the "Build Phases" place.

This do fix my problem. But I think Xcode is still really buggy and annoying.

Longlongan answered 29/6, 2013 at 7:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.