Objective-C 在后台启动 iTunes
我想启动 iTunes,但我不希望启动可见,目前我的代码导航到 iTunes 分配到的空间并使 iTunes 成为关键窗口,所以实际上我希望它在后台启动。
[[NSWorkspace sharedWorkspace] launchApplication:@"iTunes"];
有人可以帮忙吗?谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为这就是您想要的:
重要的是 NSWorkspaceLaunchWithoutActivation。
编辑:正如所发布的,如果您希望隐藏 iTunes,您也可以使用 NSWorkspaceLaunchAndHide。
I think this is what you want:
The important bit is
NSWorkspaceLaunchWithoutActivation
.Edit: As also posted, you can use NSWorkspaceLaunchAndHide as well, if you want iTunes to be hidden.
使用 -launchApplicationAtURL:options:configuration:error: 启动它,并在选项中包含 NSWorkspaceLaunchAndHide 。
Use -launchApplicationAtURL:options:configuration:error: to launch it, and include NSWorkspaceLaunchAndHide in the options.
这对你有用吗?
Should this work for you?