Swift 框架不适用于名为“Debug"或“Release"以外的构建配置:没有这样的模块 [英] Swift frameworks do not work with build configurations named other than 'Debug' or 'Release': No such module

查看:40
本文介绍了Swift 框架不适用于名为“Debug"或“Release"以外的构建配置:没有这样的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我尝试使用名为Debug"或Release"以外的构建配置时,Xcode 突然找不到我的 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 报告没有这样的模块"

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.

我创建了一个简短的截屏视频,向您展示我在做什么:http://www.screencast.com/t/zpgZ5ZYgvH

I've created a short screencast to show you exactly what I'm doing: http://www.screencast.com/t/zpgZ5ZYgvH

底线:

  1. 确保项目当前使用第三方 Swift 框架构建
  2. 在项目/文件导航器中选择项目
  3. 在编辑器左侧边栏中选择 Targets 上方的项目,并确保您位于 Info 选项卡上
  4. 通过单击配置列表下方的 + 按钮并选择复制 XXX 配置"来复制当前配置(可能是调试")
  5. 通过转到产品(菜单)> 方案 > 编辑方案...修改您的方案以使用新配置.
  6. 选择左侧边栏中的运行
  7. 在构建配置下选择您的新配置
  8. 尝试重新构建

您也可以下载示例项目:http://s000.tinyupload.com/?file_id=48797763216274271820

You can also download the sample project: http://s000.tinyupload.com/?file_id=48797763216274271820

我正在运行 Xcode 6.0.1 (6A317) 和 Yosemite 10.10 (14A361c).

I'm running Xcode 6.0.1 (6A317) and Yosemite 10.10 (14A361c).

推荐答案

在目标的Build Settings中添加以下Framework Search Path:$(SYMROOT)/Release$(EFFECTIVE_PLATFORM_NAME)并使其非递归

Add the following Framework Search Path in the Build Settings of your target: $(SYMROOT)/Release$(EFFECTIVE_PLATFORM_NAME) and make it non-recursive

在我的情况下,这是针对 Alamofire,它作为 git 子模块添加到我的项目中.

In my case this was for Alamofire, which was added to my project as a git submodule.

框架正在正确构建,可以在构建日志中看到,但我假设默认框架搜索路径是从方案名称派生的.Alamofire 框架和dSYM 文件位于 Release-iphoneos/Release-iphonesimulator.

The framework was 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.

这应该适用于任何 Swift 框架,只要它的方案名称是默认的.如果没有,请检查构建日志并相应地调整框架搜索路径.

This should work 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆