Objective c Cocoa/ObjC:获取当前流程的CbundleIdentifier

Objective c Cocoa/ObjC:获取当前流程的CbundleIdentifier,objective-c,macos,cocoa,cfbundleidentifier,Objective C,Macos,Cocoa,Cfbundleidentifier,我有一个例子,[[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: CFBundleExecut

我有一个例子,
[[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


是否有其他(更通用的)方法来获取当前进程的CbundleIdentifier?

[[NSRunningApplication runningApplicationWithProcessIdentifier:getpid()]bundleIdentifier]
有效。

您总是比我好得多:)
[[NSBundle mainBundle]bundleIdentifier]
有效吗?这将是最简单的解决方案…@MrMage:No,它返回
nil
NSString *CFBundleIdentifier = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];


(CFBundleIdentifier = @"com.yourcompany.yourapp")