【问题标题】:Where can I get the guidance or template about iTunes? [closed]我在哪里可以获得有关 iTunes 的指南或模板? [关闭]
【发布时间】:2012-12-21 08:26:41
【问题描述】:

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

【问题讨论】:

    标签: macos itunes


    【解决方案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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-22
      • 2019-09-24
      • 2010-09-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多