mdmb
mdmb

Reputation: 5283

Opening an app using another app

I'm just wondering is it possible? Let's say I wrote an app and I want to use a button to open (from the app I wrote) another app (sing its directory) on my Mac

Any idea where to start off? I've been thinking about NSFileManager but it seems like a wrong way.

Upvotes: 1

Views: 113

Answers (1)

Ken Thomases
Ken Thomases

Reputation: 90521

You should use the methods of NSWorkspace. Which method exactly depends a bit on exactly what you want to do. For example, if you have the URL for a document file and you want to open it in the appropriate app, you would use -openURL:.

If you just want to open a specific app (and not any particular document), then you should use -launchAppWithBundleIdentifier:options:additionalEventParamDescriptor:launchIdentifier:. Using a bundle identifier is the most reliable way to identify the app, rather than using its name or its URL, either of which can be changed.

Upvotes: 3

Related Questions