Is it possible to add new app variables on iPhone, similar to ${EXECUTABLE_NAME}?
I'd like to reference my own variables in my info.plist & build settings files.
Is this possible? Any id开发者_JAVA百科eas?
If you add custom build settings via the 'add build setting' button in the bottom right, then you should be able to use the ${} form within your info.plist to reference the names of those variables.
For example, I have such a setting called 'PJ_VERSION_EXTRA'. In my Info.plist I have:
<key>CFBundleShortVersionString</key>
<string>1.1${PJ_VERSION_EXTRA}</string>
In my debug build configuration, I define that setting as '-DEBUG'. That means that when I show the version string in app, debug builds identify themselves.
I can see any problems with doing this.
Should be as simple as adding an entry to the info plist, and then retrieving it using
[[[NSBundle mainBundle] infoDictionary] objectForKey:myPlistKeyName];
精彩评论