Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting an iPhone app's product name at runtime?

Tags:

ios

iphone

How can this be achieved? I would like to get the name so i can display it within an app, without having to change it in code each time i change a name, of course.

like image 210
Edward An Avatar asked Aug 07 '09 21:08

Edward An


People also ask

How do I choose an app name iOS?

As you can see there's a lot to consider when choosing your app name, so take your time and get it right. You want something unique, short, descriptive, and easy to pronounce and spell. After that you can research useful keywords and work them into your longer name, description, and keywords field.

Can iOS app name be changed?

Build Settings> Change "Product Name" TARGETS> Select app> Change "Display Name"

Can you change product name Xcode?

Go to Project -> Edit Project Settings -> Select Build tab -> look for productName in packaging category. Change it to what you want.


2 Answers

Try this

NSBundle *bundle = [NSBundle mainBundle]; NSDictionary *info = [bundle infoDictionary]; NSString *prodName = [info objectForKey:@"CFBundleDisplayName"]; 
like image 87
epatel Avatar answered Sep 20 '22 15:09

epatel


Good answers here. I would add one thing though.

Rather than using @"CFBundleDisplayName", which has the potential to change in future, it's best to cast the string constant supplied in CFBundle.h like so:

[[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleNameKey]; 

Thus future-proofing your code.

like image 37
imnk Avatar answered Sep 23 '22 15:09

imnk