How to detect if an application is launched with objective-c for mac?
Asked
Active
Viewed 754 times
-3
-
Please have a look on it. https://stackoverflow.com/questions/38971994/detect-if-the-application-in-background-or-foreground-in-swift – aBilal17 Mar 28 '18 at 13:13
-
2@aBilal17 I'm not certain how the linked answer relates to this one. This question is about macOS, not iOS. (Also not certain why there are so many close and down votes; there's nothing wrong with this question and it has a very simple but non-obvious answer.) – Rob Napier Mar 28 '18 at 13:19
1 Answers
2
"Is an application launched" can be somewhat subtle. It depends on exactly what kind of application it is, and the lines aren't always clear. That said, for the most common cases (and likely what you're looking for), use NSWorkspace
:
NSArray *apps = [[NSWorkspace sharedWorkspace] runningApplications];
You can search through that to find the NSRunningApplication
you care about. Typically the best property to use is bundleIdentifier
.

Rob Napier
- 286,113
- 34
- 456
- 610
-
-
I don't know what bit slicer is. Did you mean to ask a question here? – Rob Napier Mar 29 '18 at 13:11
-
Like game cheat tools, cheat engine, bit slicer how is it possible to detect launched apps? – lbwnb123 Apr 11 '18 at 13:07
-
As above; `runningApplications` will provide you a list of launched apps in ObjC. Is there a deeper question? – Rob Napier Apr 11 '18 at 13:27
-
-