【问题标题】:Need to delete the references of a .m file and then add them again iOS需要删除 .m 文件的引用,然后再次添加它们 iOS
【发布时间】:2013-12-19 05:39:20
【问题描述】:

我在 Xcode 项目中的多个位置更改了我的 .h 文件的 prefix header 名称,然后将标题改回原来的。看来我弄乱了我的来源或其他东西。当尝试从 UIButton 控制单击拖动到我的 .h 文件以创建 IBAction 时,

我收到以下错误:

Could not insert new action connection: Could not insert source code into document at 
URL file://localhost/Users/Myuser/file/filename/projectname/SGLoginHomeViewController.m 
because it does not contain a class interface for the class named SGLoginHomeViewController

我再次尝试在类文件 SGLoginHomeViewController.h 中创建一个新的 IBAction

我认为我需要删除引用然后将它们添加回来,但我该怎么做呢?

【问题讨论】:

    标签: objective-c ios7 xcode5


    【解决方案1】:

    按照这个:-

    To Delete reference:_
    1. Right click on your .h or .m file. 
    2. Click on "Delete". A pop up will open.
    3. Click on "Remove reference". Your file reference has been deleted.
    
    To add it again:-
    1. Right click on your project. 
    2. Click on "Add files to 'YourProjectName'". 
    3. A pop up will open. Select you file & Click Add.
    Note:- Make sure "Copy items into destination group's folder(if needed)" is unchecked.
    

    【讨论】:

    • 好的,我做到了,但现在我无法将我的文件添加回来。它是灰色的,我应该将文件保存到项目以外的其他位置吗?
    • 因为它是灰色的,所以它意味着它被添加到项目中。
    • 在您的项目位置创建一个文件夹,然后将此文件夹添加到您的 xcode 项目中。
    • 不,不是。很抱歉,但我不完全确定如何按照上面评论中的步骤进行操作。我对编程很陌生
    • 好的。跟我来:- 1. 在查找器中,转到保存项目的文件夹。 2. 你会找到一个名为“YourProjectName.xcodeproj”的文件和一个同名的文件夹,即“YourProjectName”。 3. 转到“YourProjectName”文件夹。 4. 创建一个名为“New”的新文件夹。 5. 将该文件(即 yourViewController.h 或 .m)复制到此文件夹中。 6. 现在,在 xcode 中打开项目。 7. 右键单击​​左侧窗格中的项目名称。 8. 单击“将文件添加到您的项目”。 9. 添加我们在第 1 步中创建的名为“New”的文件夹。 4..确保“将项目复制到目标文件夹”未选中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-25
    • 1970-01-01
    • 2021-11-30
    • 2013-05-12
    • 1970-01-01
    相关资源
    最近更新 更多