Reputation: 21553
I have a file path to a pdf and I want it to open in Preview. Also, I want finder to launch highlighting the file.
On iOS I would do:
UIApplication app = [UIApplication sharedApplication];
[app openURL:url];
But I have no idea what's the alternative in Cocoa app. Thanks
Upvotes: 3
Views: 2654
Reputation: 991
You should look at NSWorkspace
NSString* path = [[NSString alloc] initWithBytes:installerPath.str() length:installerPath.dataLength() encoding:NSUTF16LittleEndianStringEncoding];
[[NSWorkspace sharedWorkspace] openFile:path];
[path release];
Upvotes: 7