打开URL链接代码

1.打开URL

#define PDF_PRODUCT_URL @"http://www.cisdem.com/pdf-password-remover-mac.html"

[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:PDF_PRODUCT_URL]];

2.打开本地文件

#define  PRProductName  @"Cisdem PDFPasswordRemover"

 NSString *fullPath = [[NSBundle mainBundle] pathForResource:PRProductName ofType:@"pdf"];

    [[NSWorkspace sharedWorkspace] openFile:fullPath];

NSString* path =  [NSString stringWithFormat:@"open '%@'",[self.setSavePathBtn title]];

    system([path UTF8String]);

原文地址:https://www.cnblogs.com/PJXWang/p/5816625.html