xcode apple mach-o 链接器错误链接器命令失败,退出代码为 1(使用 -v 查看调用)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43975793/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:58:35  来源:igfitidea点击:

apple mach-o linker error linker command failed with exit code 1 (use -v to see invocation)

iosobjective-cxcodecore-datalinker

提问by Marking

enter image description here

在此处输入图片说明

2I am working with Objective C with core data, I got an error:

2我正在使用带有核心数据的 Objective C,但出现错误:

Apple Mach-O Linker Error, Linker command failed with exit code 1 (use -v to see invocation)enter image description here

Apple Mach-O 链接器错误,链接器命令失败,退出代码为 1(使用 -v 查看调用)在此处输入图片说明

回答by young

You need open detail description.

您需要打开详细说明。

step image

步骤图像

回答by Tejas K

Check if you have imported a .m file instead if .h somewhere in your project.

检查您是否导入了 .m 文件,如果 .h 在您的项目中某处。

Another thing to look for is the import of a header file twice.

要查找的另一件事是两次导入头文件。

If the above two don't work Select your project -> Build Phases -> Link Binary with Libraries. Go through the list and see if a framework is added more than once.

如果以上两个不起作用选择您的项目 -> 构建阶段 -> 将二进制文件与库链接。浏览列表,看看是否不止一次添加了一个框架。

回答by Tejas K

It's because the project inserted the core data's xcdatamodeld file in compile sources.Select your project -> Build Phases -> Compile Sources and delete projectName.xcdatamodeldfile. Just try it and reply me if still any error.

这是因为项目在编译源中插入了核心数据的 xcdatamodeld 文件选择您的项目 -> Build Phases -> Compile Sources 并删除projectName.xcdatamodeld文件。试试吧,如果仍然有任何错误,请回复我。

回答by Kumait

importing .m file instead of .h file can cause this error

导入 .m 文件而不是 .h 文件会导致此错误