我有一个案例,其中[[NSBundle mainBundle] infoDictionary]只包含以下内容:
17.09.11 18:28:26,936 [0x0-0x5a98a93].com.valvesoftware.steam: 2011-09-17 18:28:26.935 steam[85587:707] infodict: {
17.09.11 18:28:26,936 [0x0-0x5a98a93].com.valvesoftware.steam: CFBundleExecutablePath = "/Applications/Spiele/Steam.app/Contents/MacOS/osx32/steam";
17.09.11 18:28:26,936 [0x0-0x5a98a93].com.valvesoftware.steam: NSBundleInitialPath = "/Applications/Spiele/Steam.app/Contents/MacOS/osx32";
17.09.11 18:28:26,936 [0x0-0x5a98a93].com.valvesoftware.steam: NSBundleResolvedPath = "/Applications/Spiele/Steam.app/Contents/MacOS/osx32";
17.09.11 18:28:26,936 [0x0-0x5a98a93].com.valvesoftware.steam: }但我想要CFBundleIdentifier。
有没有其他(更通用的)方法来获取当前进程的CFBundleIdentifier?
发布于 2011-09-18 01:17:44
[[NSRunningApplication runningApplicationWithProcessIdentifier:getpid()] bundleIdentifier]起作用了。
发布于 2016-06-23 17:52:03
NSString *CFBundleIdentifier = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];
(CFBundleIdentifier = @"com.yourcompany.yourapp")https://stackoverflow.com/questions/7456239
复制相似问题