开发者

Is it possible to add new app variables on iPhone, similar to ${EXECUTABLE_NAME}?

开发者 https://www.devze.com 2022-12-22 06:42 出处:网络
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 i

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];
0

精彩评论

暂无评论...
验证码 换一张
取 消