xcode 根据 Xcode5 中的“构建”或“调试”模式链接框架?

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

Linking a framework depending on 'Build' or 'Debug' mode in Xcode5?

objective-cxcodemacosframeworksxcode5

提问by jerzy

I am building a Mac app using Xcode5 on 10.9.2. My project uses a third party framework -- for the sake of simplicity, let's call it XYZ.framework.

我正在 10.9.2 上使用 Xcode5 构建 Mac 应用程序。我的项目使用第三方框架——为了简单起见,我们称之为 XYZ.framework。

There are two versions of XYZ.framework provided: a debug version and a release version. The debug version of the framework is considerably larger, but it carries important functionality for debugging like printing warnings to the console, asserts, etc. The release version of the framework is smaller, faster, and is intended for production. The debug version resides at debug/XYZ.framework and the release version resides at release/XYZ.framework.

提供了两个版本的 XYZ.framework:调试版本和发布版本。该框架的调试版本要大得多,但它具有重要的调试功能,例如向控制台打印警告、断言等。该框架的发布版本更小、更快,并且用于生产。调试版本位于 debug/XYZ.framework,发布版本位于 release/XYZ.framework。

My question is: How do I include the correct version of the framework depending on my build configuration?I.E., Xcode should include debug/XYZ.framework when my build configuration is Debug, or include release/XYZ.framework when my build configuration is Release.

我的问题是:如何根据我的构建配置包含正确版本的框架?当我的构建配置为 Debug 时,IE、Xcode 应该包含 debug/XYZ.framework,或者当我的构建配置为 Release 时包含 release/XYZ.framework。

回答by Raviprakash

One possibility is,create separate folder to keep the debug version of framework and release version of framework. Next step specify the framework search path according to build configuration. Below is the steps to customise framework search path:

一种可能性是,创建单独的文件夹来保存框架的调试版本和框架的发布版本。下一步根据构建配置指定框架搜索路径。以下是自定义框架搜索路径的步骤:

  1. Go to build settings.
  2. Search for "framework search paths" in build settings.
  3. Edit framework search path according to your configuration.
  1. 转到构建设置。
  2. 在构建设置中搜索“框架搜索路径”。
  3. 根据您的配置编辑框架搜索路径。

Additionally this thread may also help you.

此外,此线程也可能对您有所帮助。

回答by l'L'l

Make a separate build target for your debug app:

为您的调试应用程序创建一个单独的构建目标:

Target > Debug.app

Under Build Phases:

在构建阶段下:

Link Binary with Libraries:

将二进制文件与库链接

Click + Then Add Your Debugging Framework
Remove the Release one by clicking -