I need to call another application inside my application (Mac OS X app). For example if I have PDF in my bundle and I want to see it call load the PDF in the viewer app. How can call the viewer and load the PDF on bundle?, any of you knows how can I do this?, I'll really appreciate your help.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
NSWorkspace does this kind of stuff the documentation has near the top the example code
[[NSWorkspace sharedWorkspace] openFile:@"/Myfiles/README"
withApplication:@"TextEdit"];
回答2:
You can invoke, openURL to open the default PDF viewer
[NSWorkspace sharedWorkspace] openFile: pdfFilePath];
and if you want to launch the application you can invoke
[[NSWorkspace sharedWorkspace] launchApplication:appPath];
Want to open PDF within your application then I recommend you to read PDFKit: Apple PDFKit Doc