Hassan Malik
Hassan Malik

Reputation: 559

How to open a folder or a file with the help of file path in OS x programatically?

I have selected a file using NSOpenPanel and save its url path, but at any time in my os x Application i want to open this file in the default mac application.Suppose if I select an file and click on the open button in my app the file should open in default preview. How could i achieve this?

Upvotes: 2

Views: 435

Answers (2)

Usman Rana
Usman Rana

Reputation: 2142

For IOS

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];

For OSX

[[NSWorkspace sharedWorkspace] openURL:url];

Upvotes: 2

Droppy
Droppy

Reputation: 9721

I think you want:

[[NSWorkspace sharedWorkspace] openURL:url];

Upvotes: 3

Related Questions