I'm trying to get app name to use as the NavController title, but whatever I do I can't get CFBundleDisplayName value. It returns 'null'.
this is the code I'm using
[NSBundle mainBundle] infoDictionary][@"CFBundleDisplayName"]
Checked bundles = there is one only. Xcode5 / dev target is iOS5. I haven't checked on a device though. Using Simulator.
Thanks!
Try this code to get app name
NSString *appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleNameKey];
Swift extension, tested with iOS 9:
extension UIApplication {
static var applicationName: String {
let mainBundle = NSBundle.mainBundle()
let key = String(kCFBundleNameKey)
let value = mainBundle.objectForInfoDictionaryKey(key) as? String
return value ?? ""
}
}
Goto project setting & set display name, Then you can check.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With