2

[[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 を取得する別の (より一般的な) 方法はありますか?

4

2 に答える 2

4

[[NSRunningApplication runningApplicationWithProcessIdentifier:getpid()] bundleIdentifier]動作します。

于 2011-09-17T17:17:43.613 に答える
0
NSString *CFBundleIdentifier = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];


(CFBundleIdentifier = @"com.yourcompany.yourapp")
于 2016-06-23T09:52:02.917 に答える