• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
problem with NSWorkspace running apps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problem with NSWorkspace running apps


  • Subject: problem with NSWorkspace running apps
  • From: Scott Ribe <email@hidden>
  • Date: Thu, 04 Sep 2014 21:55:00 -0600

I'm modernizing some code that's a nasty pastiche of ProcessSerialNumber and LSLaunchXXX and CFBundleXXX. Having found that a certain app is not running, I need to launch it and get some info on it. But here's the problem:

[[NSWorkspace sharedWorkspace] launchAppWithBundleIdentifier: @"..." options: ...]

launches the app just fine, but then:

[[NSWorkspace sharedWorkspace] runningApplications]

does not list it, even though it *is* running (and processing events)

It is as though the runningApplications method returns a cached list which is only updated when events are processed, thus I won't see the newly-launched app until the next pass through the runloop, thus cannot launch an app and immediately see it.

So, is there any way to get an NSRunningApplication instance for an app immediately after launching it, without resorting to some vile nastiness like using an NSTimer to delay the second half of what I'm doing until a later pass through the runloop??? It seems like a bad design that there's no (obvious) way to get info on an app that I just launched--to me, the obvious thing would be for launchAppWithBundleIdentifier to return an NSRunningApplication* or nil, instead of BOOL...

--
Scott Ribe
email@hidden
http://www.elevated-dev.com/
(303) 722-0567 voice





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: problem with NSWorkspace running apps
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Checking security settings?
  • Next by Date: Re: problem with NSWorkspace running apps
  • Previous by thread: Re: Checking security settings?
  • Next by thread: Re: problem with NSWorkspace running apps
  • Index(es):
    • Date
    • Thread