Open yhkaplan opened 4 years ago
INFOPLIST_FILE
build setting per configFor posterity, you can overwrite individual values in the Info.plist with INFOPLIST_PREPROCESS and INFOPLIST_PREPROCESSOR_DEFINITIONS
Example:
<key>CFBundleDisplayName</key>
<string>MY_DISPLAY_NAME</string>
settings:
base:
INFOPLIST_PREPROCESS: YES
INFOPLIST_FILE: Info.plist
Staging:
INFOPLIST_PREPROCESSOR_DEFINITIONS: "MY_DISPLAY_NAME=AppStaging"
Production:
INFOPLIST_PREPROCESSOR_DEFINITIONS: "MY_DISPLAY_NAME=App"
Wow, didn’t know that, thanks @frederoni!
Unfortunately INFOPLIST_PREPROCESS
only works for string related settings, not for dictionaries/booleans. I would for example like to add NSAppTransportSecurity
only for the debug configuration. I think this feature could still add a lot of benefit.
Instead of INFOPLIST_PREPROCESS
, you can btw also simply refer to settings using $(SETTING_NAME)
name in the plist file.
I use separate Info.plist files for different build configurations, but they share many of the same values, so I would like to use XcodeGen to generate them. Looking through the documentation and existing GitHub issues, it doesn't appear that generating multiple Info.plist files for a single target is currently possible, so I have a few questions.
As for background info, the differences between the release and debug info.plists include: CFBundleDisplayName (
${PRODUCT_NAME} Beta
for debug builds), FacebookAppID, NSAllowsLocalNetworking, and some NSExceptionDomains (production versus staging environments for third party services).