ios Xcode 9 - 链接器命令失败,退出代码为 1

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

Xcode 9 - linker command failed with exit code 1

iosxcode

提问by sunilkumar

While compiling the application getting as following error

编译应用程序时出现以下错误

" compiled with older version of Swift language (3.0) than previous files (4.0) file "

" 使用比以前的文件 (4.0) 文件更旧的 Swift 语言 (3.0) 版本编译"

Could you please help me?

请你帮助我好吗?

回答by Krishna kushwaha

Use the xcworkspace to build instead of the xcproject?

使用 xcworkspace 来构建而不是 xcproject?

This usually happens when using Cocoapods and you are building from the xcproject which doesn't know about the cocoapod libraries.

这通常发生在使用 Cocoapods 并且您从不了解 cocoapod 库的 xcproject 构建时。

回答by Abhishek Jain

Delete the derived data and do a clean build.

删除派生数据并进行干净的构建。

And if you are building a framework, make sure you've selected Generic IOS Devicewhile building or set the Build for Active Architecture onlyas true in Build Settings.

如果您正在构建一个框架,请确保您Generic IOS Device在构建时选择或Build for Active Architecture onlyBuild Settings.

回答by Ahmed Samir

I think this happens because you changed your app name or maybe the target

我认为这是因为您更改了应用程序名称或目标

look to solve this problem see your target in Podfile

寻找解决此问题的方法,请在 Podfile 中查看您的目标

and then come back to your xcode in the targetsselect your target app and in linked Frameworks and Libraries(the last one down) see if there's any podswith light color and a strange name than your target in the podfileand remove it using the minus button down .

然后回来到Xcode在目标选择目标应用程序,并在链接的框架和库(最后一跌),看看是否有任何吊舱光的颜色比你的目标和一个陌生的名字在podfile并使用减号删除按下按钮。

回答by Alex Delgado

I am probably late for you, but for future devs in problems...

我可能对你来说迟到了,但对于未来的开发者来说,问题...

If you have been manipulating the podfile or creating new targets or maybe changing the name of any of them, check that in build phases options your just have correct pod framework for the name of the targets.

如果您一直在操作 podfile 或创建新目标或可能更改其中任何一个的名称,请检查在构建阶段选项中您是否具有正确的目标名称的 pod 框架。

回答by Ankit garg

I had the two copies of files in the codebase. Deleting one copy helped code to build successfully

我在代码库中有两个文件副本。删除一份副本有助于代码构建成功

回答by Ankit garg

if you have pod first clean project and close Xcode then open terminal and go to folder of Project then pod updateopen the project and run in my case work!

如果你有 pod 首先清理项目并关闭 Xcode 然后打开终端并转到项目文件夹然后pod update打开项目并在我的案例工作中运行!

回答by KeithTheBiped

I fixed this problem today by running the app in the simulator using the target associated with the bundle file named in the Build Settings-->Bundle Loader setting of the test target. Previously I had deleted my derived data folder while working on a different target that has a different Product Name than the one associated with the test target bundle file. Rerunning the app in the simulator must have recreated the bundle file in the derived data folder that the test target is looking for and then my tests started running fine.

我今天通过使用与测试目标的 Build Settings-->Bundle Loader 设置中命名的捆绑文件关联的目标在模拟器中运行应用程序来解决这个问题。以前,我在处理与测试目标包文件关联的产品名称不同的不同目标时删除了派生数据文件夹。在模拟器中重新运行应用程序必须在测试目标正在寻找的派生数据文件夹中重新创建包文件,然后我的测试开始正常运行。

回答by ScottyBlades

I'd rather fix the specific problem, but if none of the other answers worked a full reset can solve it. If you are getting this error and you are also getting error readouts that refer to "duplicate symbol files", AND all other efforts have failed, then a full reset could work for you.

我宁愿解决特定问题,但如果其他答案都不起作用,则完全重置可以解决它。如果您收到此错误并且您还收到涉及“重复符号文件”的错误读数,并且所有其他努力都失败了,那么完全重置可能对您有用。

What worked for me:

什么对我有用:

  1. Read the error report to identify the repo that supposedly contains duplicate files.
  2. Drag repo to the trash.
  3. re-clone your repo.
  4. set up your repo with correct remote tracking. git remote add <url.git>, or git remote set-url <url.git>
  1. 阅读错误报告以识别可能包含重复文件的存储库。
  2. 将 repo 拖到垃圾箱。
  3. 重新克隆你的回购。
  4. 使用正确的远程跟踪设置您的回购。git remote add <url.git>, 或者git remote set-url <url.git>

This absolutely worked for me. In my case for some elusive reason, when I ran git pull upstream developfor a local dependency, gitwould pull in/generate duplicate files from multiple commits.

这绝对对我有用。在我的情况下,出于某种难以捉摸的原因,当我运行git pull upstream develop本地依赖项时,git会从多个提交中拉入/生成重复文件。

After following the above steps, the issue went away and git pull upstream developwas no longer pulling from multiple commits at once. Perhaps there was a weird gitcache for my repo.

按照上述步骤操作后,问题就消失了,git pull upstream develop不再一次从多个提交中提取。也许git我的回购有一个奇怪的缓存。