Objective-C Mac OS X分布式通知iTunes [英] Objective-C Mac OS X Distributed notifications iTunes

查看:116
本文介绍了Objective-C Mac OS X分布式通知iTunes的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一点帮助,我目前有一种方法;我的Mac OS X应用程序中的updateTrackInfo获取艺术家名称,曲目名称和iTunes当前正在播放的曲目的持续时间

i need a little help, i currently have a method; updateTrackInfo in my Mac OS X application which gets the artist name, the track name and duration of the track currently being played in iTunes

但是,我希望该应用程序监听分发的iTunes通知; com.apple.iTunes.playerInfo ,然后在iTunes分发通知时调用方法updateTrackInfo.请问有人需要我在标头和实现文件中写些什么.

However i want the app to listen for the distributed iTunes notification; com.apple.iTunes.playerInfo then call the method updateTrackInfo when ever the notification is distributed by iTunes. Please could someone help me, on what i would need to write in both the header and implementation file.

谢谢,萨米.

推荐答案

您在寻找

在同一个班级的其他地方...

Elsewhere in the same class...

- (void) updateTrackInfo:(NSNotification *)notification {
  NSDictionary *information = [notification userInfo];
  NSLog(@"track information: %@", information);
}

它甚至可以在通知中为您提供一整套跟踪信息.那不是很好吗?

It even gives you a whole bunch of track information in the notification. Isn't that nice?

这篇关于Objective-C Mac OS X分布式通知iTunes的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆