Search code examples
macoscocoafinder

OS X Send data to another app


I have an sandboxed OS X app that is capable to open files through Finder services and the "Open with…" option from contextual menus. I have made another sandboxed app that should send compatible files to the first app.

How can I perform an "Open with" action programmatically? I could use a service interaction too. Is that even possible? I guess I could register an URL Scheme in my first app but I'd prefer not having to release an update if everything can be done on sender app

Thx


Solution

  • If you just want to open a normal file, then take a look at

    [[NSWorkspace sharedWorkspace] openFile:@"/path/to/file" withApplication:@"YourApp"];
    

    You can find it here in the documentation.