更新到 Xcode 8 后的错误:“没有这样的模块”和“目标覆盖了`EMBEDDED_CONTENT_CONTAINS_SWIFT`构建设置”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39569743/
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
Errors after updating to Xcode 8: "No such module" and "target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT`build setting"
提问by Questioner
I'm getting No such module
for Pods when I try to build the project. If I remove the code expecting this Pod, another 'No such module' comes up for another Pod, which means every Pod must be affected. When I type pod install
I get the following messages:
No such module
当我尝试构建项目时,我正在使用 Pod。如果我删除需要这个 Pod 的代码,另一个 Pod 会出现另一个“没有这样的模块”,这意味着每个 Pod 都必须受到影响。当我输入时,pod install
我收到以下消息:
[!] The X target overrides the `EMBEDDED_CONTENT_CONTAINS_SWIFT` build setting defined in `X'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `X` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `X'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
I get each of these for both the debug and release versions of my app and the two tests, so 12 messages in total.
我在我的应用程序的调试和发布版本以及两个测试中都获得了这些信息,因此总共有 12 条消息。
I have set Always Embed Swift Standard Libraries
and EMBEDDED_CONTENT_CONTAINS_SWIFT
to NO
and YES
both in my Build Settings and this did nothing. I also added the following code to my Podfile and it didn't work either:
我已经设置Always Embed Swift Standard Libraries
并EMBEDDED_CONTENT_CONTAINS_SWIFT
以NO
和YES
无论是在我的构建设置,这什么也没做。我还在我的 Podfile 中添加了以下代码,但它也不起作用:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'NO'
end
end
end
回答by Stark
[!] The `X` target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES` build setting defined in `X'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
I had met this problem today. I solved it by
我今天遇到了这个问题。我解决了
- Go to Project/Targets -> [Project Name] -> Build Settings.
- search "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES"
- click the right of Debug, and selected 'Other', input "$(inherited)"
- do same with 'Release' and install your pod
- 转到项目/目标 -> [项目名称] -> 构建设置。
- 搜索“ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES”
- 点击Debug右侧,选择“Other”,输入“$(inherited)”
- 对'Release'做同样的事情并安装你的pod
You can follow the image below.
你可以按照下面的图片。
回答by askielboe
The errors you see when running pod install
should not cause the No such module
errors. So my guess is that these errors are unrelated.
您在运行时看到的错误pod install
不应导致No such module
错误。所以我的猜测是这些错误是无关的。
To get rid of the pod install
errors:
要摆脱pod install
错误:
This happens because you define a flag in your build settings which overrides that set by CocoaPods. It doesn't matter if you set it to YES
or NO
, it will still overwrite the setting from CocoaPods.
发生这种情况是因为您在构建设置中定义了一个标志,该标志覆盖了 CocoaPods 设置的标志。将它设置为YES
或都没有关系NO
,它仍然会覆盖 CocoaPods 的设置。
To fix this:
要解决此问题:
- Go to Project/Targets -> [Project Name] -> Build Settings.
- Find and click onthe relevant setting (you can use the search box in the top right corner).
- Press
Backspace
to remove the setting.
- 转到项目/目标 -> [项目名称] -> 构建设置。
- 找到并点击相关设置(您可以使用右上角的搜索框)。
- 按
Backspace
删除设置。
You should see the setting going from boldto normal font. This means that the setting has been deleted, and is using a default value instead.
您应该会看到设置从粗体变为普通字体。这意味着该设置已被删除,而是使用默认值。
Repeat for each flag giving you an error, and rerun pod install
to verify that it worked.
对每个给你一个错误的标志重复,然后重新运行pod install
以验证它是否有效。
Reasons for No such module
errors:
No such module
错误原因:
There are a number of way that this error can occur. Have you looked at these answers to see if any applies to your case? If you report back on that it will be easier to help you.
发生此错误的方式有多种。您是否查看了这些答案以查看是否适用于您的案例?如果您对此进行报告,将更容易为您提供帮助。
回答by BennyTheNerd
(Updated as of July 29, 2018)
(更新至 2018 年 7 月 29 日)
- Projects/Targets --> Project Name --> Build Settings
- Build Options
- Click on Always Embed Swift Standard Librariesso that it is highlighted
- Press the deletebutton on your keyboard
- 项目/目标 --> 项目名称 --> 构建设置
- 构建选项
- 单击Always Embed Swift Standard Libraries使其突出显示
- 按键盘上的删除按钮
The Always Embed Swift Standard Librariesshould no longer be Bold, and you will no longer receive this warning when performing pod updates or pod installs =)
该总是嵌入雨燕标准库不应该再大胆,并执行荚更新时,您将不再收到此警告或吊舱安装=)
回答by pableiros
This is what I worked for me:
这就是我对我来说有效的:
pod deintegrate || rm -rf Pods
pod install --verbose
rm -rf ~/Library/Developer/Xcode/DerivedData
Then I just clean my project and build it again.
然后我只是清理我的项目并重新构建它。
回答by HymanXu
when I import SDWebImage in my project second time,It worn that Module FLAnimatedImage not found,and when I pod install ,it warn "... ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES ... - Use the $(inherited)
flag, or - Remove the build settings from the target."
At last, I find the way that remove the SD completely,specialy in the finder ,in the pods' products,and delete the project in the simulator , then import SD again.
当我第二次在我的项目中导入 SDWebImage 时,它没有找到那个模块 FLAnimatedImage,当我安装时,它警告“... ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES ... - 使用该$(inherited)
标志,或者 - 从目标中删除构建设置。” 最后我找到了完全删除SD的方法,特别是在finder中,在pods的产品中,并在模拟器中删除项目,然后再次导入SD。