我知道你可以使用[iTunesDNC addObserver:self selector:@selector(updateInfo:) name:@"com.apple.iTunes.playerInfo" object:nil];
每次播放器更改歌曲/停止/播放/等时都会收到通知。但我需要的是每次 iTunes 上的信息发生更改时收到通知(例如歌曲标题更改、歌词更改、艺术家等)
有什么建议么?我很确定我只需要改变com.apple.iTunes.playerInfo到其他不属于的东西玩家信息.
我知道这应该是可能的,因为有一个名为歌曲精灵如果您在 iTunes 上编辑歌曲的 ID3 标签或添加歌词,则会更改其信息。
谢谢你!
是的,有办法。每次更改歌曲信息时,iTunes 都会发布一个“com.apple.iTunes.sourceSaved" userInfo 字典是用户库的通知。
您可以通过收听发布到分布式通知中心的每个通知来查看 iTunes 发送的此通知和其他通知。
[[NSDistributedNotificationCenter defaultCenter] addObserver:self
selector:@selector(allDistributedNotifications:)
name:nil
object:nil];
- (void) allDistributedNotifications:(NSNotification *)note
{
NSString *object = [note object];
NSString *name = [note name];
NSDictionary *userInfo = [note userInfo];
NSLog(@"<%p>%s: object: %@ name: %@ userInfo: %@", self, __PRETTY_FUNCTION__, object, name, userInfo);
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)