Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

satyam90

macrumors regular
Original poster
Jul 30, 2007
242
0
Bangalore, India
I am using Cocoa with Obj C.
I am using the following method to open a file associated with a particular application.
Code:
[[NSWorkspace sharedWorkspace] openFile:<some file path>]
But if the file is associated with certain application, it is opening.

If the file is not associated with any application, I want the user to select the application also with which the file has to be opened. In the following code we have to tell which application it has to open.
Code:
[[NSWorkspace sharedWorkspace] openFile:< some file path> withApplication:@"TextEdit"]

But I want user to select the application at run time dynamically.

--Satya.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
You can probably use LSCopyApplicationURLsForURL() (or one of the other Launch Services functions) to determine if there already is a default app to open it. If that returns empty, use NSOpenPanel to let the user select an app.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.