ios 在 Xcode 中更改产品名称后出现“ld: file not found”

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

'ld: file not found' after changing product name in Xcode

iosobjective-cxcodexcode6linker-errors

提问by hamzah

I was working on my application and i started out with a really bad name. So i decided to change it. I did that like this.

我正在处理我的应用程序,但我的名字非常糟糕。所以我决定改变它。我是这样做的。

enter image description here

在此处输入图片说明

At the top right corner i simply changed the name to what i want. and then i started getting the error as you can see there. Reveal in Logshows these details:

在右上角,我只是将名称更改为我想要的名称。然后我开始收到错误,正如您在那里看到的那样。Reveal in Log显示了这些细节:

enter image description here

在此处输入图片说明

The main error says:

主要错误说:

ld: file not found: /Users/.../XCode/DerivedData/...

ld:找不到文件:/Users/.../XCode/DerivedData/...

回答by Vamshi Krishna

Go to edit scheme as shown below. enter image description here

转到如下所示的编辑方案。 在此处输入图片说明

then uncheck all other targets except your main target under build tab. enter image description here

然后在构建选项卡下取消选中除主要目标之外的所有其他目标。 在此处输入图片说明

回答by Peege151

I recently got this error under different circumstances. Running Ionic, updating my ios platform from 3.8.0 to 4.0.1 I discovered this error.

我最近在不同的情况下遇到了这个错误。运行 Ionic,将我的 ios 平台从 3.8.0 更新到 4.0.1 我发现了这个错误。

I had to disable bitcode in my app.

我不得不在我的应用程序中禁用位码。

To do this, click your top level app icon in the file structure. In the main window, click the header build settings. In the search bar, type bit (or bitcode) and you should see enable bit code beneath

为此,请单击文件结构中的顶级应用程序图标。在主窗口中,单击标题构建设置。在搜索栏中,键入 bit(或 bitcode),您应该会在下方看到启用位代码

I had disabled it before, but I'm guessing that updating the ios platform enables bitcode so it needed to be disabled again.

我之前禁用了它,但我猜更新 ios 平台会启用位码,因此需要再次禁用它。

回答by Edison

No need to mess with schemes. Just go to build settings for your targets or project and turn off Bitcode.

没有必要搞乱计划。只需为您的目标或项目构建设置并关闭 Bitcode。

enter image description here

在此处输入图片说明

回答by YoshiJaeger

Real Issue

真正的问题

After changing the PRODUCT_NAME(as seen in the question) the erroneous reference to Host Applicationis the real cause of the issue.

更改后PRODUCT_NAME(如问题所示)对主机应用程序的错误引用是问题的真正原因。

Just select your Tests-Target and under the General-Tab select your updated Host Application.

只需选择您的 Tests-Target 并在 General-Tab 下选择您更新的 Host Application。

Afterwards, building the project will work.

之后,构建项目将起作用。

Tests Host Application

测试主机应用程序

回答by TechFanatic

I resolved this by Deleting the Derived Data and rebuilding the project.

我通过删除派生数据并重建项目解决了这个问题。

  1. Go to Windows > Projects
  2. Select Your Project
  3. Delete Derived Data
  4. Build your project and Run
  1. 转到 Windows > 项目
  2. 选择您的项目
  3. 删除派生数据
  4. 构建您的项目并运行

回答by Hwangho Kim

If you see this error without detail result then check 'enum' in header file. Move them in .m file.

如果您在没有详细结果的情况下看到此错误,请检查头文件中的“枚举”。将它们移动到 .m 文件中。

回答by O_k

By deleting the derived data Xcode will recompile and regenerate the data for you.

通过删除派生数据,Xcode 将为您重新编译并重新生成数据。

You can do that by going to: Windows -> projects Delete derived data

您可以通过以下方式执行此操作:Windows -> 项目 删除派生数据