Get app name from bundle id
Most of the time, you can get with this...
NSString *appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:(id)kCFBundleNameKey];
EDIT:
AS you want to find for all the apps.
NSString *appName = [[NSBundle bundleWithIdentifier:@"BundleIdentifier"] objectForInfoDictionaryKey:(id)kCFBundleExecutableKey];NSLog(@"AppName: %@",appName);
This should do it.
NSBundle *bundle = [NSBundle bundleWithIdentifier:@"yourBundleIdentifier"];NSString *appName = [bundle objectForInfoDictionaryKey:@"CFBundleExecutable"];
Method
- (NSString *)titleOfAppWithBundleIdentifier:(NSString *)bundleIdentifier { NSBundle *bundle = [NSBundle bundleWithIdentifier:bundleIdentifier]; return [bundle objectForInfoDictionaryKey:@"CFBundleExecutable"];}
I set up the bundle dictionary as follows:
NSDictionary *bundleInfo = [[NSBundle mainBundle] infoDictionary];NSString *appName = [bundleInfo objectForKey:@"CFBundleDisplayName"];
And here is the bundleInfo
dumped:
{ BuildMachineOSBuild = ...; CFBundleDevelopmentRegion = ...; CFBundleDisplayName = ...; CFBundleExecutable = ...; CFBundleIcons = { CFBundlePrimaryIcon = { CFBundleIconFiles = ( "AppIcon29x29.png", "AppIcon29x29@2x.png", "AppIcon40x40@2x.png", "AppIcon57x57.png", "AppIcon57x57@2x.png", "AppIcon60x60@2x.png", "AppIcon60x60@3x.png" ); UIPrerenderedIcon = 1; }; }; CFBundleIdentifier = ...; CFBundleInfoDictionaryVersion = ...; CFBundleInfoPlistURL = ...; CFBundleName = ...; CFBundleNumericVersion = 0; CFBundlePackageType = APPL; CFBundleShortVersionString = ...; CFBundleSignature = "????"; CFBundleSupportedPlatforms = ( iPhoneOS ); CFBundleVersion = "1.0.11"; DTCompiler = ...; DTPlatformBuild = ...; DTPlatformName = iphoneos; DTPlatformVersion = "8.3"; DTSDKBuild = ...; DTSDKName = "iphoneos8.3"; DTXcode = ...; DTXcodeBuild = ...; LSRequiresIPhoneOS = 1; MinimumOSVersion = "5.1"; UIBackgroundModes = ( ..., ... ); UIDeviceFamily = ( 1 ); UILaunchImageFile = LaunchImage; UILaunchImages = ( { UILaunchImageMinimumOSVersion = "7.0"; UILaunchImageName = ...; UILaunchImageOrientation = Portrait; UILaunchImageSize = "{320, 568}"; } ); UIMainStoryboardFile = Main; UIRequiredDeviceCapabilities = ( armv7 ); UISupportedInterfaceOrientations = ( UIInterfaceOrientationPortrait ); UIViewControllerBasedStatusBarAppearance = 0;}