Using info.plist for storing target-specific values for a multi-target app

偶尔善良 提交于 2020-01-01 04:03:19

问题


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.

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.

Therefore, my questions are:

  1. Is it acceptable to include custom (non-Apple defined) keys in the info.plist file?
  2. Is this a suitable place to include meta for the app which differ between targets?

回答1:


It is acceptable and suitable.

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.



来源:https://stackoverflow.com/questions/2989127/using-info-plist-for-storing-target-specific-values-for-a-multi-target-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!