使用info.plist存储多目标应用程序的特定于目标的值 [英] Using info.plist for storing target-specific values for a multi-target app

查看:71
本文介绍了使用info.plist存储多目标应用程序的特定于目标的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个多目标iPhone应用程序,目前包含一个带有常量定义的头文件,这些定义在构建时有条件地包含,具体取决于正在构建的目标。

I have a multi-target iPhone app which currently includes a header file with constant definitions that are conditionally included at build time depending on which target is being built.

但是,我想知道是否可能更好地将此信息包含在构建的info.plist中,因为这通常包含特定于目标的元,因此在逻辑上似乎更合适。

However, I was wondering if it might be better to instead include this information in the info.plist for the build, as this generally holds target-specific meta, so logically seems more appropriate.

因此,我的问题是:


  1. 在info.plist中包含自定义(非Apple定义的)​​键是否可以接受文件?

  2. 这是否适合包含目标不同的应用程序的元素?


推荐答案

这是可接受和合适的。

Info.plist文件已预处理(必须通过设置包装在项目设置中启用/预处理Info.plist文件为是)由C预处理器,所以你可以有变量(以 $ {VARIABLE_NAME} )。这些变量可以在Xcode的目标信息中的用户定义部分中定义,从而可以非常轻松地将其值从一个目标切换到另一个目标。

The Info.plist file is preprocessed (must be enabled in project settings by setting Packaging / Preprocess Info.plist File to Yes) by the C pre-processor, so you can have variables (in the form of ${VARIABLE_NAME}). These variables can be defined in the User Defined section in Xcode's target info, making it very easy to switch their value from one target to another.

这篇关于使用info.plist存储多目标应用程序的特定于目标的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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