2

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?

Hassan Malik
  • 559
  • 6
  • 20

2 Answers2

3

I think you want:

[[NSWorkspace sharedWorkspace] openURL:url];
Droppy
  • 9,691
  • 1
  • 20
  • 27
2

For IOS

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

For OSX

[[NSWorkspace sharedWorkspace] openURL:url];
Usman Rana
  • 2,067
  • 1
  • 21
  • 32