Ios 从应用程序包ID获取应用程序名称
我一直在尝试从存储在数组中的bundles ID(例如Ios 从应用程序包ID获取应用程序名称,ios,objective-c,theos,bundle-identifier,Ios,Objective C,Theos,Bundle Identifier,我一直在尝试从存储在数组中的bundles ID(例如com.apple.mobilesafari)中获取应用程序名。我已经尝试使用下面的代码,但是由于我用来检索appName的代码行显然不起作用,appName的输出为空 for (NSString *str in valididentifiers){ NSString *appName = [[NSBundle bundleWithIdentifier:str] objectForInfoDictionaryKey:(id)kCFBundle
com.apple.mobilesafari
)中获取应用程序名。我已经尝试使用下面的代码,但是由于我用来检索appName的代码行显然不起作用,appName的输出为空
for (NSString *str in valididentifiers){
NSString *appName = [[NSBundle bundleWithIdentifier:str] objectForInfoDictionaryKey:(id)kCFBundleExecutableKey];
NSLog(@"AppName: %@",appName);
}
我还尝试了手动设置bundle ID的代码(出于测试目的),当我将MobileSafari作为应用程序名称时,发现了类似的空结果。这是我的代码
NSString *appName = [[NSBundle bundleWithIdentifier:@"com.apple.mobilesafari"] objectForInfoDictionaryKey:(id)kCFBundleExecutableKey];
NSLog(@"AppName: %@",appName);
两种情况下的NSLog输出:
2017-07-19 19:47:28.362: AppName: (null)
因此,我不知道我是否走错了方向或犯了某种错误,但如果能提供任何帮助,我将不胜感激。可能的副本