Objective-C 使用 NSRunningApplication 终止,退出 iTunes
我想从我的应用程序中退出 iTunes,这是我到目前为止的代码,但我收到错误 NSRunningApplication -未声明。
if ([closeiTunes state] == NSOnState) {
[[NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.iTunes"] objectAtIndex:0] terminate];
}
有人可以帮忙吗?谢谢。
I want to quit iTunes from my app, this is the code i have so far, but i get the error NSRunningApplication -undeclared.
if ([closeiTunes state] == NSOnState) {
[[NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.iTunes"] objectAtIndex:0] terminate];
}
Can anyone help? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
NSRunningApplication
是一个仅在 10.6 SDK 中可用的类。将Base SDK设置为Mac OS X 10.6应该没有问题。NSRunningApplication
is a class that is only available in the 10.6 SDK. Set the Base SDK to Mac OS X 10.6 and there should be no problems.