Swift框架不能用于“Debug”或“Release”以外的构建配置:没有这样的模块 [英] Swift frameworks do not work with build configurations named other than 'Debug' or 'Release': No such module
问题描述
每当我尝试使用名为Debug或Release之外的构建配置时,Xcode突然找不到我的Swift框架。配置与其名称完全相同(事实上,新配置与工作'Debug'配置重复)。
Xcode报告'没有这样的模块'
<这似乎是一个非常奇怪的错误。当然有人曾经遇到过这个问题吗?我的Google搜索没有结果。有谁知道可能导致这个问题的原因是什么?我很确定我正确添加了框架。
我创建了一个简短的截屏视频,向您展示我正在做的事情: http://www.screencast.com/t/zpgZ5ZYgvH
结论:
- 确保项目当前使用第三方Swift框架构建
- 选择项目在项目/文件导航器中
- 在编辑器左侧栏中选择目标上方的项目并确保您在信息选项卡上
- 复制当前配置(可能是'Debug')通过单击配置列表下方的+按钮并选择'Duplicate XXX Configuration'
- 通过转到Product(菜单)修改您的方案以使用新配置> Scheme> Edit Scheme ...
- 选择左侧边栏中的Run
- 在Build Configuration下选择新配置
- 尝试再次构建
您还可以下载示例项目: http://s000.tinyupload.com/?file_id=48797763216274271820
我正在运行Xcode 6.0.1(6A317)和Yosemite 10.10(14A361c)。
添加以下框架搜索路径
在目标的构建设置
中:
$(SYMROOT)/ Release $(EFFECTIVE_PLATFORM_NAME)
并将其设为非递归
在我的情况下,这是针对Alamofire的,已添加到我的项目中作为git子模块。
框架正在构建中,可以在构建日志中看到,但我假设默认框架搜索路径是从方案名称派生的。 Alamofire框架& dSYM文件位于 Release-iphoneos
/ Release-iphonesimulator
。
我认为这将适用于任何Swift框架,只要它的方案名称是默认的。如果没有,请检查构建日志并相应地调整框架搜索路径。
Whenever I try to use a build configuration named other than 'Debug' or 'Release', Xcode suddenly cannot find my Swift frameworks. The configurations are the exact same other than their name (in fact, the new configuration was duplicated from the working 'Debug' configuration).
Xcode reports 'No such module'
This seems like a really strange bug. Surely someone has come across this before? My Google search yielded no results. Does anyone have any idea what may be causing this issue? I'm pretty sure I added the framework correctly.
I've created a short screencast to show you exactly what I'm doing: http://www.screencast.com/t/zpgZ5ZYgvH
Bottom line:
- Make sure project currently builds using third-party Swift frameworks
- Select the project in the project/file navigator
- Select the project above Targets in the editor left sidebar and make sure you are on the Info tab
- Duplicate the current configuration (likely 'Debug') by clicking the + button below the list of configurations and selecting 'Duplicate XXX Configuration'
- Modify your scheme to use the new configuration by going to Product (menu) > Scheme > Edit Scheme...
- Select Run in the left sidebar
- Select your new configuration under Build Configuration
- Attempt to build again
You can also download the sample project: http://s000.tinyupload.com/?file_id=48797763216274271820
I'm running Xcode 6.0.1 (6A317) and Yosemite 10.10 (14A361c).
Add the following Framework Search Path
in the Build Settings
of your target:
$(SYMROOT)/Release$(EFFECTIVE_PLATFORM_NAME)
and make it non-recursive
In my case this was for Alamofire, which was added to my project as a git submodule.
The framework is being built correctly which can be seen in the build logs, but I assume the default framework search path is derived from the scheme name. The Alamofire framework & dSYM file are in Release-iphoneos
/ Release-iphonesimulator
.
I assume this will work with any Swift framework as long as it's scheme names are default. If not, check the build logs and adjust the framework search path accordingly.
这篇关于Swift框架不能用于“Debug”或“Release”以外的构建配置:没有这样的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!