-1

我想开发一个应用程序,而不是一个扩展。但应用程序有权控制 iTunes 并获取音乐信息,例如来自 iTunes 的歌词(类似于 SuperTunes)。我在哪里可以获得相关的模板或指南?谢谢。

4

1 回答 1

1

至于 iTunes 的控制,没有原生的 cocoa API,但是您可以使用 AppleScript,可以使用以下方式从应用程序运行:

NSString* path = [[NSBundle mainBundle] pathForResource:@"ScriptName" ofType:@"scpt"];
NSURL* url = [NSURL fileURLWithPath:path];NSDictionary* errors = [NSDictionary dictionary];
NSAppleScript* appleScript = [[NSAppleScript alloc] initWithContentsOfURL:url error:&errors];
[appleScript executeAndReturnError:nil];

可以使用的 AppleScript 命令的一个很好的例子,可以在这里找到:http: //dougscripts.com/itunes/itinfo/info03.php

于 2012-12-21T08:33:11.140 回答