Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find Bundle Identifier from known PID?

I have the pid (process identifier) of an arbitrary running process. How can I find the bundle identifier (if any) of the associated application?

like image 762
Nick Moore Avatar asked Jul 22 '10 14:07

Nick Moore


People also ask

How do I find the bundle identifier?

To locate the Apple bundle ID: Log into your iTunes Connect account. Click the relevant app. Go to General > App Information. The Bundle ID is displayed.

How do I find my swift bundle ID?

Open you project with XCode, select the top project item in the project navigator at the left. Then select TARGETS -> General. Bundle Identifier is found under Identity.

How do I find my bundle ID XCode?

In Xcode 4, select your project, then your target (you should have only one) and then the 'Info' tab. You should be able to see the bundle identifier there.


2 Answers

I've found an answer which works on 10.6 only:

[[NSRunningApplication runningApplicationWithProcessIdentifier:pid] bundleIdentifier]

like image 112
Nick Moore Avatar answered Sep 29 '22 17:09

Nick Moore


Here's a way that works in 10.2 and later: First call GetProcessForPID to turn the pid into a ProcessSerialNumber. Then call ProcessInformationCopyDictionary to get the bundle ID. (Added: these functions are deprecated in OS 10.9. I don't know if they still exist in the 10.10 SDK.)

like image 39
JWWalker Avatar answered Sep 29 '22 19:09

JWWalker