Objective-C Mac OS X分布式通知iTunes
发布时间:2020-12-14 18:56:06 所属栏目:百科 来源:网络整理
导读:我需要一点帮助,我现在有一个方法;我的Mac OS X应用程序中的updateTrackInfo获取当前在iTunes中播放的艺术家名称,曲目名称和曲目的持续时间 但是,我希望应用程序监听分发的iTunes通知; com.apple.iTunes.playerInfo然后在iTunes分发通知时调用方法updateTrac
我需要一点帮助,我现在有一个方法;我的Mac OS X应用程序中的updateTrackInfo获取当前在iTunes中播放的艺术家名称,曲目名称和曲目的持续时间
但是,我希望应用程序监听分发的iTunes通知; com.apple.iTunes.playerInfo然后在iTunes分发通知时调用方法updateTrackInfo.请有人帮助我,我需要在标题和实现文件中写什么. 谢谢,萨米. 解决方法
你在找
-[NSDistributedNotificationCenter addObserver:selector:name:object:] :
NSDistributedNotificationCenter *dnc = [NSDistributedNotificationCenter defaultCenter]; [dnc addObserver:self selector:@selector(updateTrackInfo:) name:@"com.apple.iTunes.playerInfo" object:nil]; 在同一个班级的其他地方…… - (void) updateTrackInfo:(NSNotification *)notification { NSDictionary *information = [notification userInfo]; NSLog(@"track information: %@",information); } 它甚至可以在通知中为您提供一大堆跟踪信息.不是很好吗? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |