.xcconfig 文件是调试和发布的配置文件,其文件中有规范。在幕后,在 Xcode 中,它在编译生命周期中是如何工作的,是我的查询。何时使用 .xcconfig 文件。我从未在创建框架时使用过它们,我是否需要使用它们?
最佳答案
我没有找到太多关于最佳实践的信息,所以我会根据我的意见来回答。 .xcconfig
文件允许您:
- 只需复制和分配
.xcconfig
即可在不同项目中重复使用相同的配置文件 - 通过将不同的配置传递给 xcodebuid
xcodebuild -target <your_target_name> -xcconfig <your_configuration_file>.xcconfig
来构建您的项目 - 将配置与繁重的 Xcode 项目文件分开,这样可以更轻松地跟踪更改
在Xcode项目中你可以设置.xcconfig
s 用于项目和目标级别的每个配置(调试、发布)。
Xcode 按以下顺序使用从 .xcodeproj 和分配的 .xccofig 文件组合的设置:
- 默认 macOS
- Xcode 项目级别
- .xcconfig 项目级别
- .xcconfig 目标级别
- Xcode 目标级别
每个下一级的设置将覆盖上一级的设置。
您可以构建您的 .xccconfig
随心所欲的文件层次结构,这给了你很大的灵 active 。其中一个层次结构可能如下所示:
- Warnings.xcconfig - keep warnings separate
|- Base.xcconfig - settings common for debug and release; inherits Warnings.scconfig
|- Debug.xcconfig - debug only settings; inherits Base.xcconfig
|- Release.xcconfig - release only settings; inherits Base.xcconfig
- Target1.xcconfig - target specific settings, like Info.plist or product name
- Target2_Debug.xcconfig - target settings for debug
- Target2_Release.xcconfig - target settings for release
关于ios - 了解 Xcode 中的 .xcconfig 文件,我们为什么要使用它。我看到一个用于调试,一个用于发布。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44673099/