Created
July 10, 2012 06:00
-
-
Save scottjacksonx/3081450 to your computer and use it in GitHub Desktop.
From an app bundle identifier, return the name of that app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSString+AppName.h | |
// | |
// Created by Scott Jackson on 4/07/12. | |
// Copyright (c) 2012 SJSoftware. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface NSString (AppName) | |
+ (NSString *)nameOfApplicationWithBundleIdentifier:(NSString *)bundleIdentifier; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSString+AppName.m | |
// | |
// Created by Scott Jackson on 4/07/12. | |
// Copyright (c) 2012 SJSoftware. All rights reserved. | |
// | |
#import "NSString+AppName.h" | |
@implementation NSString (AppName) | |
+ (NSString *)nameOfApplicationWithBundleIdentifier:(NSString *)bundleIdentifier { | |
NSString *bundlePath = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:bundleIdentifier]; | |
NSBundle *appBundle = [NSBundle bundleWithPath:bundlePath]; | |
return [appBundle objectForInfoDictionaryKey:(id)kCFBundleNameKey]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment