重命名 Xcode 6 项目后出错:“链接器命令失败,退出代码为 1(使用 -v 查看调用)”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26197542/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error after renaming Xcode 6 project: "linker command failed with exit code 1 (use -v to see invocation)"
提问by skyguy
So after I create an Xcode 6 project, even if I haven't written any code in it, if I try renaming it by double clicking the bolded program title in the upper left hand corner of the navigator and then confirming that I want the checked items' names changed, I get the following error when I try running it: "clang: error: linker command failed with exit code 1 (use -v to see invocation)"
因此,在我创建一个 Xcode 6 项目之后,即使我没有在其中编写任何代码,如果我尝试通过双击导航器左上角的粗体程序标题来重命名它,然后确认我想要选中项目的名称已更改,当我尝试运行它时出现以下错误:“clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)”
I've even tried using the find tool to see all the things named the previous name, including the info.plist (which I think is the problem) and changing them to the new name. By renaming the info.plist manually I get an error saying that doesn't exist.
我什至尝试使用查找工具来查看所有以以前名称命名的内容,包括 info.plist(我认为这是问题所在)并将它们更改为新名称。通过手动重命名 info.plist,我收到一条错误消息,指出不存在。
What am I doing wrong?
我究竟做错了什么?
回答by ccwasden
I saw the same error after changing the name, and I was able to fix it by clearing the "Test Host" values in the Build Settings of my "Tests" target:
更改名称后我看到了同样的错误,我能够通过清除“测试”目标的构建设置中的“测试主机”值来修复它:
Alternatively, If you need your tests to be able to run after changing the name of your project, you should be able to update the MyProject.app/MyProject
value in both fields to reflect the new name of your project (ie. MyNewProject.app/MyNewProject
)
或者,如果您需要在更改项目名称后运行测试,您应该能够更新MyProject.app/MyProject
两个字段中的值以反映项目的新名称(即。MyNewProject.app/MyNewProject
)
回答by Stéphane Bruckert
If above method(s) doesn't work and if for now you don't feel like needing to test anything in your project, just remove your project test target.
如果上述方法不起作用,并且现在您不想测试项目中的任何内容,只需删除您的项目 test target。
Later on if you need to create some tests, you will still be able to add test targets again.
稍后如果您需要创建一些测试,您仍然可以再次添加测试目标。
回答by Norly Canarias
Go to the Build Settings of my "Tests" target then change the paths from the old project name to your new project name
转到我的“测试”目标的构建设置,然后将路径从旧项目名称更改为新项目名称
Test Host
- Debug Build/Debug-iphoneos/OldProjectName.app/OldProjectName
- Release Build/Release-iphoneos/OldProjectName.app/OldProjectName
Test Host
- Debug Build/Debug-iphoneos/NewProjectName.app/NewProjectName
- Release Build/Release-iphoneos/NewProjectName.app/NewProjectName
Just simply clearing them would break your tests so you need to replace them with the new project name.
只需简单地清除它们就会破坏您的测试,因此您需要将它们替换为新的项目名称。
回答by RickJansen
Ran into this too, after copying and renaming the folder with an xcode project. I think it's a bug in xcode. Best file a bug with bugreporter (https://bugreport.apple.com/). Removing the test target from my project fixed it for me, too.
在使用 xcode 项目复制并重命名文件夹后,也遇到了这个问题。我认为这是 xcode 中的一个错误。最好使用 bugreporter ( https://bugreport.apple.com/)提交错误。从我的项目中删除测试目标也为我修复了它。
回答by thomas kim
Here is what I've done to fix the similar problem since I changed the project name and folders under the project.
这是我为解决类似问题所做的工作,因为我更改了项目下的项目名称和文件夹。
- Select project file : projectName.xcodeproj
- Right click on the project file and click "Show package contents" to open project.pbxproj file.
- Once ope project.pbxproj file, replace all from old project name (whatever you changed from) to new name.
- You can change the name of sub folder if you changed folder name too.
- 选择项目文件:projectName.xcodeproj
- 右键单击项目文件,然后单击“显示包内容”以打开 project.pbxproj 文件。
- 打开 project.pbxproj 文件后,将旧项目名称(无论您更改的内容)中的所有内容替换为新名称。
- 如果您也更改了文件夹名称,则可以更改子文件夹的名称。
Hope this help.
希望这有帮助。
回答by Luciano LB
There are different places where you should check for the rename. You should check for the "old" project name in the test target and in the project target. Search for the old name string and rename them manually to the new name.
您应该在不同的地方检查重命名。您应该检查测试目标和项目目标中的“旧”项目名称。搜索旧名称字符串并手动将它们重命名为新名称。
回答by Alessandro Pirovano
If you doesn't use the test target you can delete this target.
如果您不使用测试目标,则可以删除此目标。
回答by Mundi
There are many places you have to check upon re-naming. This approach does not seem at all practical.
在重命名时,您必须检查很多地方。这种方法似乎根本不实用。
If you really need to do this, I recommend creating a new project and just copying the necessary files over to the new project.
如果您确实需要这样做,我建议您创建一个新项目并将必要的文件复制到新项目中。