Hi All,

I wanted to open a Finder window from my app with a file pre-selected. The user 
could perform any Finder operations needed. I looked around the internet and it 
turns out the best way to do this is using NSWorkspace.


- (void)applicationDidFinishLaunching:(NSNotification *)aNotification

{

    // Insert code here to initialize your application

    NSURL *fileURL = [NSURL URLWithString:@"/Users/usr/Desktop/libd.dylib"];

    NSArray *fileURLs = [NSArray arrayWithObjects:fileURL, nil];

    [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:fileURLs];

}

However, I am not sure what is going on. The Finder window never pops up. I do 
see the top bar change to Finder bar but then the window is never present. The 
file I am trying to highlight is present. Is there anyway to know error code? 
The method is void.

Regards,
Varun
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to