I would like to put application name on UILabel.
I have found how to put App version or App build using <<APP_VERSION>>
or <<APP_BUILD>>
. I would like also to put the application name in the same way, is there any something like <<APP_NAME>>
in Xcode?
I have two different build targets in the project, each with different app name.
Asked
Active
Viewed 109 times
1

Micgal
- 133
- 1
- 1
- 11
-
Take a look at this question, maybe it's what you want https://stackoverflow.com/questions/8320860/how-to-get-the-name-of-the-running-application-in-ios – trungduc Nov 05 '17 at 09:17
-
I thought about ` <<>> ` option, as I can use it without any line of code. But ` [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]; ` is also acceptable to include in the code. Thanks! – Micgal Nov 05 '17 at 09:27
-
i have added an answer to make it easier. You should take a look ;) – trungduc Nov 05 '17 at 09:38
-
The application name cannot be changed at runtime so what's wrong with using a simple literal (localized) string? – vadian Nov 05 '17 at 09:41
1 Answers
3
If you want use it without any line of code.
First, define APP_NAME
#define APP_NAME [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"]
And use APP_NAME as a NSString
value
NSLog(@"%@", APP_NAME);

trungduc
- 11,926
- 4
- 31
- 55