ios Apple Mach -O Linker 命令失败

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

Apple Mach -O Linker command failed

iosxcodexcode6linker-errorsduplicate-symbol

提问by Phoenix Haroz

random issue is happening

随机问题正在发生

After updating my POD install, Xcode sprouted a new issue:

更新我的 POD 安装后,Xcode 出现了一个新问题:

回答by blackops

Make sure you open the .xcworkspacefile rather than the project file (.xcodeproj) when working with pods. That should solve the issue with linking.

确保在使用 Pod 时打开.xcworkspace文件而不是项目文件 ( .xcodeproj)。这应该可以解决链接问题。

回答by MRustamzade

Some times you need just clean build. It helped me. To clean build go Product -> Clean

有时你只需要干净的构建。它帮助了我。要清理构建,请转到Product -> Clean

回答by AnujAroshA

There are several cases that cause this issue. At the moment, this question has no any accepted answer and also I found another solution for the same issue, I am posting my answer/experience here.

有几种情况会导致此问题。目前,这个问题没有任何公认的答案,我也为同一问题找到了另一个解决方案,我在这里发布我的答案/经验。

In you application, go to Target -> Build Settings, then you will find following attributes.

在您的应用程序中,转到 Target -> Build Settings,然后您将找到以下属性。

  • CLANG_WARN_INFINITE_RECURSION
  • CLANG_WARN_SUSPICIOUS_MOVE
  • GCC_NO_COMMON_BLOCKS
  • CLANG_WARN_INFINITE_RECURSION
  • CLANG_WARN_SUSPICIOUS_MOVE
  • GCC_NO_COMMON_BLOCKS

Set values for those as NO, then clean and build the project.

将这些值设置为 NO,然后清理并构建项目。

回答by CMA

Following steps helped me to get rid of this problem:

以下步骤帮助我摆脱了这个问题:

  1. Go to project path and remove Pods folder and Podfile.lock file.
  2. Reinstall pods again using "pod install" command.
  3. Open xcworkspace and clean it before running.
  1. 转到项目路径并删除 Pods 文件夹和 Podfile.lock 文件。
  2. 使用“pod install”命令再次重新安装 pod。
  3. 运行前打开 xcworkspace 并清理它。

Hope it will save someone's time like it did for me.

希望它能像为我一样节省别人的时间。

回答by Naveen Kumar M

Close you project and go to project path and select your project with .xcworkspaceinstead of .xcodeproj. Reason your existing project doesn't contain any library you linked.

关闭您的项目并转到项目路径并使用.xcworkspace而不是选择您的项目.xcodeproj。您现有项目不包含您链接的任何库的原因。

ss

SS

回答by S.Jain

Remove the local files of WikitudeSDKfrom target. Xcode is getting confused between the paths of library, which one to chose- pod or local.

从目标中删除WikitudeSDK的本地文件。Xcode 在库的路径之间感到困惑,选择哪个 - pod 或本地。

Also try reinstalling podfile and remove wikitude from pod file to. IN linker search path settings, in build settings, check the paths mentioned to find the required library.

也尝试重新安装 podfile 并从 pod 文件中删除 wikitude。在链接器搜索路径设置中,在构建设置中,检查提到的路径以找到所需的库。

Lastly install gems before updating pods

最后在更新 pod 之前安装 gems

回答by Boomerange

You have to check Link Binary With Libraries option. Sometimes you build pod that is not in your project anymore.

您必须检查 Link Binary With Libraries 选项。有时您构建的 pod 不再存在于您的项目中。

On the left panel click on your project name, then under Targets again (click on name), then Build Phases > Link Binary With Files. Delete everything that you dont use.

在左侧面板上单击您的项目名称,然后再次在 Targets 下(单击名称),然后Build Phases > Link Binary With Files。删除您不使用的所有内容。

回答by Lakhdeep Singh

Solved - Best Way

已解决 - 最佳方式

pod deintegrate  
pod install

Open xcworkspace and clean it before running.

运行前打开 xcworkspace 并清理它。

回答by Punja Solanki

the solution for me was open the .xcworkspace file insted of .xcodeproj located inside my '/platforms/ios' folder.

我的解决方案是打开位于我的“/platforms/ios”文件夹内的 .xcodeproj 的 .xcworkspace 文件。

回答by Yuvraj Sinh

I got same error like duplication of "variable name". You need to check all variable and function name for all .m file and make sure it's not same in any other file.Then clean and build.

我遇到了同样的错误,比如“变量名”重复。您需要检查所有 .m 文件的所有变量和函数名称,并确保它在任何其他文件中都不相同。然后清理并构建。

It's working for me.

它对我有用。