Search code examples
objective-cbackgroundituneslaunch

Objective-C launch iTunes in background


I want to launch iTunes but i don't want the launch to be visible, at the moment the code i have navigates to the space which iTunes is assigned to and makes iTunes the key window, so effectively i want it to launch in the background.

[[NSWorkspace sharedWorkspace] launchApplication:@"iTunes"];

Can anyone help? Thanks.


Solution

  • Use -launchApplicationAtURL:options:configuration:error: to launch it, and include NSWorkspaceLaunchAndHide in the options.