IOS Xcode solves the problem of "cocould not insert new outlet connection ., Xcodeoutlet

Source: Internet
Author: User

IOS Xcode solves the problem of "cocould not insert new outlet connection ., Xcodeoutlet

In Xcode, you can connect an interface element to the corresponding code file by using the "Control key + drag" button on the StoryBoard editing interface or the xib editing interface, create an outlet in the code file.


However, if you are not lucky, you may encounter the following errors during the above operations:

Cocould not insert new outlet connection: cocould not find any information for the class named "xxx ".

"Xxx" is the class name in your target code file.


If you encounter such a problem, take the above error message to Baidu, you will find a lot of relevant content, there are various solutions, but the effect is different, some people say this method is easy to use, some people say that this method is easy to use. Here we will sort out some common situations and corresponding solutions.


First, the first case is the simplest and most easily overlooked, that is, you did not choose to add this class to the corresponding "Target" when creating a new class.

The check method is very simple. Select the class you want to operate on. m File. On the "Target Membership" page of the "File inspector" interface, check whether the corresponding "Target" is selected, if it is not selected, it means that you made a small mistake when creating the class.

The modification method is very simple. Just select the Target in the target Membership on the "File inspector" interface.


If your situation does not match the above, it may be that the Derive file of your project has some problems. There are several solutions in the following ways, which are similar in principle, that is, try to recreate some background files of the project.


1. Add the file to the project again

The operation step is to select the. m and. H files with the problem, click the delete key, and then select "Remove Reference", so that the file will not be deleted. Select the "File-> Add Files to..." menu and select the. m File and. h File on the File selection page to Add them to the project.


2. Directly Delete DeriveData

The procedure is to close the current project, close Xcode, and locate the following directory through Terminal or Finder:

~ /Library/Developer/XCode/DerivedData

Find the files starting with your project and delete them.

Restart Xcode.


3. Delete the DeriveData of the project in Organizer.

If you do not know about the Mac operating system and do not know how to operate the 2nd solutions, you can select "Windows-> Organizer" in Xcode ", select "Projects", select the project you are processing, and click the "Delete" button corresponding to "DeriveData". Xcode will Delete the DeriveData of the project and then automatically generate a new one.


We hope the above method can help you solve the problem of "cocould not insert new outlet connection.


Xcode50 why can't I select outlet if I drag the creation method and the connection is only action gray?

I guess you are dragging on a method, so it can only be action. To select outlet, drag it to the blank area and release it.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.