How to get localized CFBundleDisplayName
Try this for Swift:
// Localized
if let displayName = Bundle.main.localizedInfoDictionary?["CFBundleDisplayName"] as? String {
print("App Display Name - \(displayName)")
}
// Non-Localized
if let displayName = Bundle.main.infoDictionary?["CFBundleDisplayName"] as? String {
print("App Display Name - \(displayName)")
}
Also try this, if you have not set Display Name
// Localized
if let appName = Bundle.main. localizedInfoDictionary?["CFBundleName"] as? String {
print("App Name - \(appName)")
}
// Non-Localized
if let appName = Bundle.main.infoDictionary?["CFBundleName"] as? String {
print("App Name - \(appName)")
}
Useful trick:
// Print bundle info dictionary to get complete details about app
print("Bundle.main.infoDictionary - \(Bundle.main.infoDictionary)")
print("Bundle.main.localizedInfoDictionary - \(Bundle.main.localizedInfoDictionary)")
Have you tried -[NSBundle localizedInfoDictionary]
?
[[[NSBundle mainBundle] localizedInfoDictionary]
objectForKey:@"CFBundleDisplayName"]