40media Getting an iPhone app's product name at runtime?


Getting an iPhone app's product name at runtime?



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.


how to release uiview added as subview in scrollview?

1:

Populate a UITableView with data
Try this. Dynamically change url or WordPress theme if UserAgent is iPhone
    NSBundle *bundle = [NSBundle mainBundle];     NSDictionary *info = [bundle infoDictionary];     NSString *prodName = [info objectForKey:@"CFBundleDisplayName"]; 
inheritance in objective CProgram to change the phone numbers a call is redirected to if a mobile phone cannot be reached?

2:

How to change UITabBar Selection color
iPhone SDK: GameKit and large files + connection lostGood answers here. remove every type of subview from uiscrollview? 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..

3:

According to Apple, using - objectForInfoDictionaryKey: directly on the NSBundle object is preferred:.
Use of this method is preferred over another access methods for the reason this it returns the localized value of a key when one is available..
Here's an case in Swift:.
let appName = NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleName") as! String // Or use key "CFBundleDisplayName" 

4:

I had a problem when I localize my application name by using InfoPlist.strings, like.
CFBundleDisplayName = "My Localized App Name"; 
I could not obtain localized application name if I use infoDictionary.. In this case I used localizedInfoDirectory like below. .
NSDictionary *locinfo = [bundle localizedInfoDictionary]; 

5:

you must use the direct approach,. in .h file,.
IBOutlet UILabel *lableAppName;  labelAppName.text = [[[NSBundle mainBundle] infoDictionary]                         objectForKey:@"CFBundleDisplayName"]; 

6:

This is just a swift update for this very old question. I was in need of swift answer and it was kind of tricky(Unwrapping optionals) in swift syntax so sharing it here.
let productName = NSBundle.mainBundle().infoDictionary!["CFBundleName"]! 

7:

For completeness, Swift 3.0 would be;.
let appName = Bundle.main.object(forInfoDictionaryKey: "CFBundleDisplayName") as! String 

8:

You could have all bundle details from this dictionary "info". print this dictionary and receive what you want..
NSBundle *bundle = [NSBundle mainBundle]; NSDictionary *info = [bundle infoDictionary]; 


74 out of 100 based on 59 user ratings 534 reviews